2017-02-09 20:02:59 +00:00
|
|
|
# TIL
|
|
|
|
|
2017-02-09 20:56:45 +00:00
|
|
|
CFLAGS=-std=c99 -Wall -Wextra -g
|
2017-02-09 20:02:59 +00:00
|
|
|
|
2017-02-09 23:50:47 +00:00
|
|
|
TARGET=interp
|
2017-02-09 20:02:59 +00:00
|
|
|
PREFIX=/usr/local
|
|
|
|
|
|
|
|
# C sources
|
2017-02-12 15:27:18 +00:00
|
|
|
HEADERS=vm.h ds.h compile.h parse.h value.h disasm.h datatypes.h
|
2017-02-11 19:01:06 +00:00
|
|
|
SOURCES=main.c parse.c value.c vm.c ds.c compile.c disasm.c
|
2017-02-09 20:02:59 +00:00
|
|
|
OBJECTS=$(patsubst %.c,%.o,$(SOURCES))
|
|
|
|
|
|
|
|
all: $(TARGET)
|
|
|
|
|
|
|
|
$(TARGET): $(OBJECTS)
|
|
|
|
$(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS)
|
|
|
|
|
2017-02-09 23:50:47 +00:00
|
|
|
%.o : %.c $(HEADERS)
|
2017-02-09 20:02:59 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
install: $(TARGET)
|
|
|
|
cp $(TARGET) $(PREFIX)/bin
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm $(TARGET) || true
|
|
|
|
rm $(OBJECTS) || true
|
|
|
|
|
|
|
|
run: $(TARGET)
|
|
|
|
./$(TARGET)
|
|
|
|
|
|
|
|
debug: $(TARGET)
|
|
|
|
gdb $(TARGET)
|
|
|
|
|
2017-02-09 20:56:45 +00:00
|
|
|
valgrind: $(TARGET)
|
2017-02-10 04:28:11 +00:00
|
|
|
valgrind ./$(TARGET) --leak-check=full
|
2017-02-09 20:56:45 +00:00
|
|
|
|
|
|
|
.PHONY: clean install run debug valgrind
|