Added test for variadic arguments
[xonotic/gmqcc.git] / Makefile
1 DESTDIR :=
2 PREFIX := /usr/local
3 BINDIR := $(PREFIX)/bin
4
5 CC     ?= clang
6 CFLAGS += -Wall -I. -fomit-frame-pointer -fno-stack-protector -fno-common
7 #turn on tons of warnings if clang is present
8 ifeq ($(CC), clang)
9         CFLAGS +=                  \
10                 -Weverything                  \
11                 -Wno-missing-prototypes       \
12                 -Wno-unused-parameter         \
13                 -Wno-sign-compare             \
14                 -Wno-implicit-fallthrough     \
15                 -Wno-sign-conversion          \
16                 -Wno-conversion               \
17                 -Wno-disabled-macro-expansion \
18                 -Wno-padded                   \
19                 -Wno-format-nonliteral
20
21 endif
22 ifeq ($(track), no)
23     CFLAGS += -DNOTRACK
24 endif
25
26 OBJ     =             \
27           util.o      \
28           code.o      \
29           ast.o       \
30           ir.o        \
31           con.o
32           
33 OBJ_T = test.o util.o con.o
34 OBJ_C = main.o lexer.o parser.o
35 OBJ_X = exec-standalone.o util.o con.o
36
37
38 default: gmqcc
39 %.o: %.c
40         $(CC) -c $< -o $@ $(CFLAGS)
41
42 exec-standalone.o: exec.c
43         $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
44
45 qcvm: $(OBJ_X)
46         $(CC) -o $@ $^ $(CFLAGS) -lm
47
48 gmqcc: $(OBJ_C) $(OBJ)
49         $(CC) -o $@ $^ $(CFLAGS)
50
51 test: $(OBJ_T)
52         $(CC) -o $@ $^ $(CFLAGS)
53         
54 runtests:
55         ./test
56
57 all: gmqcc qcvm test
58
59 clean:
60         rm -f *.o gmqcc qcvm test *.dat
61
62
63 $(OBJ) $(OBJ_C) $(OBJ_X): gmqcc.h
64 main.o: lexer.h
65 parser.o: ast.h lexer.h
66 ast.o: ast.h ir.h
67 ir.o: ir.h
68
69 install: install-gmqcc install-qcvm
70 install-gmqcc: gmqcc
71         install -d -m755          $(DESTDIR)$(BINDIR)
72         install    -m755  gmqcc   $(DESTDIR)$(BINDIR)/gmqcc
73 install-qcvm: qcvm
74         install -d -m755          $(DESTDIR)$(BINDIR)
75         install    -m755  qcvm    $(DESTDIR)$(BINDIR)/qcvm