]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
let test_ast compile again
[xonotic/gmqcc.git] / Makefile
1 CC     ?= clang
2 CFLAGS += -Wall -I. -pedantic-errors -std=c90
3
4 #turn on tons of warnings if clang is present
5 ifeq ($(CC), clang)
6         CFLAGS +=                  \
7                 -Weverything                  \
8                 -Wno-missing-prototypes       \
9                 -Wno-unused-parameter         \
10                 -Wno-sign-compare             \
11                 -Wno-implicit-fallthrough     \
12                 -Wno-sign-conversion          \
13                 -Wno-conversion               \
14                 -Wno-disabled-macro-expansion \
15                 -Wno-padded                   \
16                 -Wno-format-nonliteral
17
18 endif
19 OBJ     = \
20           util.o      \
21           code.o      \
22           ast.o       \
23           ir.o        \
24           error.o
25 OBJ_A = test/ast-test.o
26 OBJ_I = test/ir-test.o
27 OBJ_C = main.o lexer.o parser.o
28 OBJ_X = exec-standalone.o util.o
29
30 #default is compiler only
31 default: gmqcc
32 %.o: %.c
33         $(CC) -c $< -o $@ $(CFLAGS)
34
35 exec-standalone.o: exec.c
36         $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
37
38 # test targets
39 test_ast: $(OBJ_A) $(OBJ)
40         $(CC) -o $@ $^ $(CFLAGS)
41 test_ir:  $(OBJ_I) $(OBJ)
42         $(CC) -o $@ $^ $(CFLAGS)
43 qcvm:     $(OBJ_X)
44         $(CC) -o $@ $^ $(CFLAGS)
45 exec.o: execloop.h
46 exec-standalone.o: execloop.h
47 test: test_ast test_ir
48
49 # compiler target
50 gmqcc: $(OBJ_C) $(OBJ)
51         $(CC) -o $@ $^ $(CFLAGS)
52
53 #all target is test and all
54 all: test gmqcc
55
56 clean:
57         rm -f *.o gmqcc qcvm test_ast test_ir test/*.o
58         
59