]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
added test_ast, test_ir, and test, as well as default, and all to the Makefile target...
[xonotic/gmqcc.git] / Makefile
1 CC     ?= clang
2 CFLAGS += -Wall -I. -pedantic-errors -std=c90
3 OBJ     = main.o      \
4           lex.o       \
5           error.o     \
6           parse.o     \
7           typedef.o   \
8           util.o      \
9           code.o      \
10           asm.o       \
11           ast.o       \
12           ir.o
13 # ast and ir test
14 TEST_AST = test/ast-test.o
15 TEST_IR  = test/ir-test.o
16
17 #default is compiler only
18 default: gmqcc
19 %.o: %.c
20         $(CC) -c $< -o $@ $(CFLAGS)
21
22 # test targets
23 test_ast: $(TEST_AST) $(OBJ)
24         $(CC) -o $@ $^ $(CFLAGS)        
25 test_ir:  $(TEST_IR) $(OBJ)
26         $(CC) -o $@ $^ $(CFLAGS)
27 test: test_ast test_ir
28
29 # compiler target       
30 gmqcc: $(OBJ)
31         $(CC) -o $@ $^ $(CFLAGS)
32
33 #all target is test and all
34 all: test gmqcc
35         
36 clean:
37         rm -f *.o gmqcc test_ast test_ir test/*.o