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. -fno-strict-aliasing -fsigned-char
13 CFLAGS += -DGMQCC_GITINFO="`git describe`"
14 #turn on tons of warnings if clang is present
15 # but also turn off the STUPID ONES
20 -Wno-format-nonliteral \
21 -Wno-disabled-macro-expansion \
23 -Wno-missing-prototypes \
27 #Tiny C Compiler doesn't know what -pedantic-errors is
28 # and instead of ignoring .. just errors.
30 CFLAGS +=-pedantic-errors
32 CFLAGS += -Wno-pointer-sign -fno-common
40 OBJ_D = util.o code.o ast.o ir.o conout.o ftepp.o opts.o file.o utf8.o correct.o
41 OBJ_T = test.o util.o conout.o file.o
42 OBJ_C = main.o lexer.o parser.o file.o
43 OBJ_X = exec-standalone.o util.o conout.o file.o
45 ifneq ("$(CYGWIN)", "")
46 #nullify the common variables that
47 #most *nix systems have (for windows)
54 TESTSUITE = testsuite.exe
56 ifneq ("$(MINGW)", "")
57 #nullify the common variables that
58 #most *nix systems have (for windows)
65 TESTSUITE = testsuite.exe
67 #arm support for linux .. we need to allow unaligned accesses
68 #to memory otherwise we just segfault everywhere
69 ifneq (, $(findstring arm, $(shell uname -m)))
70 CFLAGS += -munaligned-access
82 $(CC) -c $< -o $@ $(CFLAGS)
84 exec-standalone.o: exec.c
85 $(CC) -c $< -o $@ $(CFLAGS) -DQCVM_EXECUTOR=1
88 $(CC) -o $@ $^ $(CFLAGS) -lm
90 $(GMQCC): $(OBJ_C) $(OBJ_D)
91 $(CC) -o $@ $^ $(CFLAGS)
93 $(TESTSUITE): $(OBJ_T)
94 $(CC) -o $@ $^ $(CFLAGS)
96 all: $(GMQCC) $(QCVM) $(TESTSUITE)
102 rm -f *.o $(GMQCC) $(QCVM) $(TESTSUITE) *.dat
105 $(OBJ_D) $(OBJ_C) $(OBJ_X): gmqcc.h opts.def
107 parser.o: ast.h lexer.h
114 install: install-gmqcc install-qcvm install-doc
115 install-gmqcc: $(GMQCC)
116 install -d -m755 $(DESTDIR)$(BINDIR)
117 install -m755 $(GMQCC) $(DESTDIR)$(BINDIR)/gmqcc
118 install-qcvm: $(QCVM)
119 install -d -m755 $(DESTDIR)$(BINDIR)
120 install -m755 $(QCVM) $(DESTDIR)$(BINDIR)/qcvm
122 install -d -m755 $(DESTDIR)$(MANDIR)/man1
123 install -m755 doc/gmqcc.1 $(DESTDIR)$(MANDIR)/man1/
124 install -m755 doc/qcvm.1 $(DESTDIR)$(MANDIR)/man1/