]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
'make qcvm' now builds exec-standalone.o from exec.c with -DQCVM_EXECUTOR=1
[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     = lex.o       \
20           error.o     \
21           parse.o     \
22           typedef.o   \
23           util.o      \
24           code.o      \
25           asm.o       \
26           ast.o       \
27           ir.o 
28 OBJ_A = test/ast-test.o
29 OBJ_I = test/ir-test.o
30 OBJ_C = main.o
31 OBJ_X = exec-standalone.o util.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)
48 exec.o: qcvm_execprogram.h
49 exec-standalone.o: qcvm_execprogram.h
50 test: test_ast test_ir
51
52 # compiler target
53 gmqcc: $(OBJ_C) $(OBJ)
54         $(CC) -o $@ $^ $(CFLAGS)
55
56 #all target is test and all
57 all: test gmqcc
58
59 clean:
60         rm -f *.o gmqcc test_ast test_ir test/*.o
61         
62