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