]> git.xonotic.org Git - xonotic/gmqcc.git/blob - Makefile
Updating makefile to remove all the not yet used stuff
[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           error.o     \
21           util.o      \
22           code.o      \
23           ast.o       \
24           ir.o
25 OBJ_A = test/ast-test.o
26 OBJ_I = test/ir-test.o
27 OBJ_C = main.o
28
29 #default is compiler only
30 default: gmqcc
31 %.o: %.c
32         $(CC) -c $< -o $@ $(CFLAGS)
33
34 # test targets
35 test_ast: $(OBJ_A) $(OBJ)
36         $(CC) -o $@ $^ $(CFLAGS)
37 test_ir:  $(OBJ_I) $(OBJ)
38         $(CC) -o $@ $^ $(CFLAGS)
39 test: test_ast test_ir
40
41 # compiler target
42 gmqcc: $(OBJ_C) $(OBJ)
43         $(CC) -o $@ $^ $(CFLAGS)
44
45 #all target is test and all
46 all: test gmqcc
47
48 clean:
49         rm -f *.o gmqcc test_ast test_ir test/*.o
50         
51