]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
Merge branch 'master' into blub/bc3
[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 OBJ_A = test/ast-test.o
25 OBJ_I = test/ir-test.o
26 OBJ_C = main.o lexer.o parser.o
27 OBJ_X = exec-standalone.o util.o
28
29 #default is compiler only
30 default: gmqcc
31 %.o: %.c
32         $(CC) -c $< -o $@ $(CFLAGS)
33
34 exec-standalone.o: exec.c
35         $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
36
37 # test targets
38 test_ast: $(OBJ_A) $(OBJ)
39         $(CC) -o $@ $^ $(CFLAGS)
40 test_ir:  $(OBJ_I) $(OBJ)
41         $(CC) -o $@ $^ $(CFLAGS)
42 qcvm:     $(OBJ_X)
43         $(CC) -o $@ $^ $(CFLAGS)
44 exec.o: execloop.h
45 exec-standalone.o: execloop.h
46 test: test_ast test_ir
47
48 # compiler target
49 gmqcc: $(OBJ_C) $(OBJ)
50         $(CC) -o $@ $^ $(CFLAGS)
51
52 #all target is test and all
53 all: test gmqcc
54
55 clean:
56         rm -f *.o gmqcc qcvm test_ast test_ir test/*.o
57         
58