3 BINDIR := $(PREFIX)/bin
4 DATADIR := $(PREFIX)/share
5 MANDIR := $(DATADIR)/man
7 UNAME ?= $(shell uname)
8 CYGWIN = $(findstring CYGWIN, $(UNAME))
9 MINGW = $(findstring MINGW32, $(UNAME))
12 CFLAGS += -Wall -Wextra -I. -pedantic-errors -fno-strict-aliasing
13 #turn on tons of warnings if clang is present
14 # but also turn off the STUPID ONES
19 -Wno-format-nonliteral \
20 -Wno-disabled-macro-expansion \
22 -Wno-missing-prototypes \
30 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o
31 OBJ_T = test.o util.o conout.o file.o
32 OBJ_C = main.o lexer.o parser.o file.o
33 OBJ_X = exec-standalone.o util.o conout.o file.o
35 ifneq ("$(CYGWIN)", "")
36 #nullify the common variables that
37 #most *nix systems have (for windows)
44 TESTSUITE = testsuite.exe
46 ifneq ("$(MINGW)", "")
47 #nullify the common variables that
48 #most *nix systems have (for windows)
55 TESTSUITE = testsuite.exe
66 $(CC) -c $< -o $@ $(CFLAGS)
68 exec-standalone.o: exec.c
69 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
72 $(CC) -o $@ $^ $(CFLAGS) -lm
74 $(GMQCC): $(OBJ_C) $(OBJ_D)
75 $(CC) -o $@ $^ $(CFLAGS)
77 $(TESTSUITE): $(OBJ_T)
78 $(CC) -o $@ $^ $(CFLAGS)
80 all: $(GMQCC) $(QCVM) $(TESTSUITE)
86 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) *.dat
89 $(OBJ_D) $(OBJ_C) $(OBJ_X): gmqcc.h opts.def
91 parser.o: ast.h lexer.h
97 install: install-gmqcc install-qcvm install-doc
98 install-gmqcc: $(GMQCC)
99 install -d -m755 $(DESTDIR)$(BINDIR)
100 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
101 install-qcvm: $(QCVM)
102 install -d -m755 $(DESTDIR)$(BINDIR)
103 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
105 install -d -m755 $(DESTDIR)$(MANDIR)/man1
106 install -m755 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
107 install -m755 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/