3 UNAME ?= $(shell uname)
4 CYGWIN = $(findstring CYGWIN, $(UNAME))
5 MINGW = $(findstring MINGW32, $(UNAME))
7 CFLAGS += -Wall -Wextra -Werror -fno-strict-aliasing $(OPTIONAL)
8 ifneq ($(shell git describe --always 2>/dev/null),)
9 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
11 #turn on tons of warnings if clang is present
12 # but also turn off the STUPID ONES
17 -Wno-format-nonliteral \
18 -Wno-disabled-macro-expansion \
20 -Wno-missing-prototypes \
22 -Wno-unknown-warning-option \
25 #Tiny C Compiler doesn't know what -pedantic-errors is
26 # and instead of ignoring .. just errors.
28 CFLAGS += -pedantic-errors
30 CFLAGS += -Wno-pointer-sign -fno-common
33 #-Wstrict-prototypes is not valid in g++
35 CFLAGS += -Wstrict-prototypes
39 #we have duplicate object files when dealing with creating a simple list
40 #for dependinces. To combat this we use some clever recrusive-make to
41 #filter the list and remove duplicates which we use for make depend
42 RMDUP = $(if $1,$(firstword $1) $(call RMDUP,$(filter-out $(firstword $1),$1)))
43 DEPS := $(call RMDUP, $(OBJ_P) $(OBJ_T) $(OBJ_C) $(OBJ_X))
45 ifneq ("$(CYGWIN)", "")
46 #nullify the common variables that
47 #most *nix systems have (for windows)
54 TESTSUITE = testsuite.exe
57 ifneq ("$(MINGW)", "")
58 #nullify the common variables that
59 #most *nix systems have (for windows)
66 TESTSUITE = testsuite.exe
78 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
80 exec-standalone.o: exec.c
81 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
84 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
86 $(GMQCC): $(OBJ_C) $(OBJ_D)
87 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
89 $(TESTSUITE): $(OBJ_T)
90 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
93 $(CC) -o $@ $^ $(LDFLAGS)
95 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
103 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe
106 @ splint $(SPLINTFLAGS) *.c *.h
109 @ gource $(GOURCEFLAGS)
112 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
115 @ makedepend -Y -w 65536 2> /dev/null $(subst .o,.c,$(DEPS))
118 install: install-gmqcc install-qcvm install-gmqpak install-doc
119 install-gmqcc: $(GMQCC)
120 install -d -m755 $(DESTDIR)$(BINDIR)
121 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
122 install-qcvm: $(QCVM)
123 install -d -m755 $(DESTDIR)$(BINDIR)
124 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
125 install-gmqpak: $(PAK)
126 install -d -m755 $(DESTDIR)$(BINDIR)
127 install -m755 $(PAK) $(DESTDIR)$(BINDIR)/$(PAK)
129 install -d -m755 $(DESTDIR)$(MANDIR)/man1
130 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
131 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
132 install -m644 doc/gmqpak.1 $(DESTDIR)$(MANDIR)/man1/
136 util.o: gmqcc.h opts.def
137 fs.o: gmqcc.h opts.def
138 conout.o: gmqcc.h opts.def
139 opts.o: gmqcc.h opts.def
140 pak.o: gmqcc.h opts.def
141 stat.o: gmqcc.h opts.def
142 test.o: gmqcc.h opts.def
143 main.o: gmqcc.h opts.def lexer.h
144 lexer.o: gmqcc.h opts.def lexer.h
145 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
146 code.o: gmqcc.h opts.def
147 ast.o: gmqcc.h opts.def ast.h ir.h
148 ir.o: gmqcc.h opts.def ir.h
149 ftepp.o: gmqcc.h opts.def lexer.h
150 utf8.o: gmqcc.h opts.def
151 correct.o: gmqcc.h opts.def