]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
Finishing the preprocessing flag for the lexer, added preprocess.c to test it
[xonotic/gmqcc.git] / Makefile
1 CC     ?= clang
2 CFLAGS += -Wall -I. -pedantic-errors
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 ifeq ($(track), no)
20     CFLAGS += -DNOTRACK
21 endif
22
23 OBJ     = \
24           util.o      \
25           code.o      \
26           ast.o       \
27           ir.o        \
28           preprocess.o \
29           error.o
30 OBJ_A = test/ast-test.o
31 OBJ_I = test/ir-test.o
32 OBJ_C = main.o lexer.o parser.o
33 OBJ_X = exec-standalone.o util.o
34
35 #default is compiler only
36 default: gmqcc
37 %.o: %.c
38         $(CC) -c $< -o $@ $(CFLAGS)
39
40 exec-standalone.o: exec.c
41         $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
42
43 # test targets
44 test_ast: $(OBJ_A) $(OBJ)
45         $(CC) -o $@ $^ $(CFLAGS)
46 test_ir:  $(OBJ_I) $(OBJ)
47         $(CC) -o $@ $^ $(CFLAGS)
48 qcvm:     $(OBJ_X)
49         $(CC) -o $@ $^ $(CFLAGS) -lm
50 exec.o: execloop.h
51 exec-standalone.o: execloop.h
52 test: test_ast test_ir
53
54 # compiler target
55 gmqcc: $(OBJ_C) $(OBJ)
56         $(CC) -o $@ $^ $(CFLAGS) $(LIBS)
57
58 #all target is test and all
59 all: test gmqcc
60
61 clean:
62         rm -f *.o gmqcc qcvm test_ast test_ir test/*.o
63         
64