1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
UNAME = $(shell uname)
CC = gcc
CFLAGS = -g -Wall -O2
LIBS = -lz
OFILES = util.o keywords.o flasm.o unflasm.o lex.yy.o assembler.tab.o
GARBAGE = assembler.tab.* lex.yy.c memwatch.o gmon.out memwatch.log core
# if make debug, include memwatch and all symbols
ifneq (,$(findstring debug,$(MAKECMDGOALS)))
CFLAGS += -DMEMWATCH -pg -p -pedantic -W -Wcast-align -Wcast-qual -Wshadow -Wnested-externs -Wstrict-prototypes -Waggregate-return -Wmissing-prototypes -Wpointer-arith
OFILES += memwatch.o
else
CFLAGS += -s
endif
# executable should not depend on cygwin.dll
ifneq (,$(findstring CYGWIN,$(UNAME)))
CFLAGS += -mno-cygwin
endif
all: flasm
debug: flasm
clean:
-rm -f ${OFILES} ${GARBAGE}
flasm: ${OFILES}
${CC} $(CFLAGS) -o flasm ${OFILES} ${LIBS}
assembler.tab.c assembler.tab.h: assembler.y
bison --defines --debug assembler.y
lex.yy.c: assembler.flex assembler.tab.h
flex -i assembler.flex
keywords.c: keywords.gperf assembler.tab.h
gperf --language=ANSI-C -t -T -E -o -k 1,$$,2,5 -S8 keywords.gperf > keywords.c
|