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