2012-04-25 14:20:38 +00:00
|
|
|
CC ?= clang
|
2012-04-29 20:54:05 +00:00
|
|
|
CFLAGS += -Wall -I. -pedantic-errors -std=c90
|
2012-04-17 08:29:58 +00:00
|
|
|
OBJ = main.o \
|
|
|
|
lex.o \
|
|
|
|
error.o \
|
|
|
|
parse.o \
|
|
|
|
typedef.o \
|
|
|
|
util.o \
|
|
|
|
code.o \
|
2012-04-26 09:36:28 +00:00
|
|
|
asm.o \
|
|
|
|
ast.o \
|
|
|
|
ir.o
|
2012-04-29 20:54:05 +00:00
|
|
|
# ast and ir test
|
|
|
|
TEST_AST = test/ast-test.o
|
|
|
|
TEST_IR = test/ir-test.o
|
2012-04-09 10:42:06 +00:00
|
|
|
|
2012-04-29 20:54:05 +00:00
|
|
|
#default is compiler only
|
|
|
|
default: gmqcc
|
2012-04-09 10:42:06 +00:00
|
|
|
%.o: %.c
|
2012-04-10 01:32:24 +00:00
|
|
|
$(CC) -c $< -o $@ $(CFLAGS)
|
2012-04-09 10:42:06 +00:00
|
|
|
|
2012-04-29 20:54:05 +00:00
|
|
|
# test targets
|
|
|
|
test_ast: $(TEST_AST) $(OBJ)
|
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
|
|
|
test_ir: $(TEST_IR) $(OBJ)
|
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
|
|
|
test: test_ast test_ir
|
|
|
|
|
|
|
|
# compiler target
|
2012-04-09 10:42:06 +00:00
|
|
|
gmqcc: $(OBJ)
|
|
|
|
$(CC) -o $@ $^ $(CFLAGS)
|
2012-04-29 20:54:05 +00:00
|
|
|
|
|
|
|
#all target is test and all
|
|
|
|
all: test gmqcc
|
2012-04-09 10:42:06 +00:00
|
|
|
|
|
|
|
clean:
|
2012-04-29 20:54:05 +00:00
|
|
|
rm -f *.o gmqcc test_ast test_ir test/*.o
|