4 BINDIR := $(PREFIX)/bin
5 DATADIR := $(PREFIX)/share
6 MANDIR := $(DATADIR)/man
8 UNAME ?= $(shell uname)
9 CYGWIN = $(findstring CYGWIN, $(UNAME))
10 MINGW = $(findstring MINGW32, $(UNAME))
13 # linker flags and optional additional libraries if required
17 CFLAGS += -Wall -Wextra -Werror -fno-strict-aliasing $(OPTIONAL)
18 ifneq ($(shell git describe --always 2>/dev/null),)
19 CFLAGS += -DGMQCC_GITINFO="\"$(shell git describe --always)\""
21 #turn on tons of warnings if clang is present
22 # but also turn off the STUPID ONES
27 -Wno-format-nonliteral \
28 -Wno-disabled-macro-expansion \
30 -Wno-missing-prototypes \
32 -Wno-unknown-warning-option
34 #Tiny C Compiler doesn't know what -pedantic-errors is
35 # and instead of ignoring .. just errors.
37 CFLAGS += -pedantic-errors
39 CFLAGS += -Wno-pointer-sign -fno-common
47 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o fs.o utf8.o correct.o
48 OBJ_P = util.o fs.o conout.o opts.o pak.o
49 OBJ_T = test.o util.o conout.o fs.o
50 OBJ_C = main.o lexer.o parser.o fs.o
51 OBJ_X = exec-standalone.o util.o conout.o fs.o
53 ifneq ("$(CYGWIN)", "")
54 #nullify the common variables that
55 #most *nix systems have (for windows)
62 TESTSUITE = testsuite.exe
65 ifneq ("$(MINGW)", "")
66 #nullify the common variables that
67 #most *nix systems have (for windows)
74 TESTSUITE = testsuite.exe
86 --date-format "%d %B, %Y" \
87 --seconds-per-day 0.01 \
88 --auto-skip-seconds 1 \
91 --camera-mode overview \
92 --highlight-all-users \
94 --hide progress,mouse \
96 --max-files 99999999999 \
97 --max-file-lag 0.000001 \
98 --bloom-multiplier 1.3 \
99 --logo doc/html/gmqcc.png \
102 #ffmpeg flags for gource
145 -shiftimplementation \
168 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
170 exec-standalone.o: exec.c
171 $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS) -DQCVM_EXECUTOR=1
174 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
176 $(GMQCC): $(OBJ_C) $(OBJ_D)
177 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
179 $(TESTSUITE): $(OBJ_T)
180 $(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
183 $(CC) -o $@ $^ $(LDFLAGS)
185 all: $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK)
193 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) $(PAK) *.dat gource.mp4 *.exe
196 @ splint $(SPLINTFLAGS) *.c *.h
199 @ gource $(GOURCEFLAGS)
202 @ gource $(GOURCEFLAGS) -o - | ffmpeg $(FFMPEGFLAGS) gource.mp4
205 @makedepend -Y -w 65536 2> /dev/null \
206 $(subst .o,.c,$(OBJ_D))
207 @makedepend -a -Y -w 65536 2> /dev/null \
208 $(subst .o,.c,$(OBJ_T))
209 @makedepend -a -Y -w 65536 2> /dev/null \
210 $(subst .o,.c,$(OBJ_C))
211 @makedepend -a -Y -w 65536 2> /dev/null \
212 $(subst .o,.c,$(OBJ_X))
213 @makedepend -a -Y -w 65536 2> /dev/null \
214 $(subst .o,.c,$(OBJ_P))
217 install: install-gmqcc install-qcvm install-doc
218 install-gmqcc: $(GMQCC)
219 install -d -m755 $(DESTDIR)$(BINDIR)
220 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/$(GMQCC)
221 install-qcvm: $(QCVM)
222 install -d -m755 $(DESTDIR)$(BINDIR)
223 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/$(QCVM)
225 install -d -m755 $(DESTDIR)$(MANDIR)/man1
226 install -m644 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
227 install -m644 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/
230 rm $(DESTDIR)$(BINDIR)/gmqcc
231 rm $(DESTDIR)$(BINDIR)/qcvm
232 rm $(DESTDIR)$(MANDIR)/man1/doc/gmqcc.1
233 rm $(DESTDIR)$(MANDIR)/man1/doc/qcvm.1
237 util.o: gmqcc.h opts.def
238 code.o: gmqcc.h opts.def
239 ast.o: gmqcc.h opts.def ast.h ir.h
240 ir.o: gmqcc.h opts.def ir.h
241 conout.o: gmqcc.h opts.def
242 ftepp.o: gmqcc.h opts.def lexer.h
243 opts.o: gmqcc.h opts.def
244 fs.o: gmqcc.h opts.def
245 utf8.o: gmqcc.h opts.def
246 correct.o: gmqcc.h opts.def
248 test.o: gmqcc.h opts.def
249 util.o: gmqcc.h opts.def
250 conout.o: gmqcc.h opts.def
251 fs.o: gmqcc.h opts.def
253 main.o: gmqcc.h opts.def lexer.h
254 lexer.o: gmqcc.h opts.def lexer.h
255 parser.o: gmqcc.h opts.def lexer.h ast.h ir.h intrin.h
256 fs.o: gmqcc.h opts.def
258 util.o: gmqcc.h opts.def
259 conout.o: gmqcc.h opts.def
260 fs.o: gmqcc.h opts.def
262 util.o: gmqcc.h opts.def
263 fs.o: gmqcc.h opts.def
264 conout.o: gmqcc.h opts.def
265 opts.o: gmqcc.h opts.def
266 pak.o: gmqcc.h opts.def