Olaf Seibert d38f4009c4 Crank up the warning levels, and adjust the code to silence ...
several compilers:
- gcc version 4.5.3 (NetBSD nb2 20110806)
- gcc version 4.9.2 (Ubuntu 4.9.2-10ubuntu13)
- Ubuntu clang version 3.6.0-2ubuntu1 (tags/RELEASE_360/final) (based on LLVM 3.6.0)

The warnings were mostly about local variables shadowing others,
unused function parameters, and C++ style comments. Some variables were
indeed used before set.

Note that on Linux, using -std=c99 does stupid things like *remove* the
declaration of strdup() from <string.h>. Therefore I've reluctantly used
-std=gnu99.
2015-05-27 21:51:26 +02:00

71 lines
2.1 KiB
Makefile

#####
#
# Makefile for macro11 and dumpobj
#
WARNS ?= -Wall -Wshadow -Wextra -pedantic -Woverflow -Wstrict-overflow
CFLAGS ?= -O -ggdb -std=gnu99 $(WARNS)
MACRO11_SRCS = macro11.c \
assemble.c assemble_globals.c assemble_aux.c \
extree.c listing.c macros.c parse.c rept_irpc.c symbols.c \
mlb-rsx.c object.c stream2.c util.c rad50.c
MACRO11_OBJS = $(MACRO11_SRCS:.c=.o)
DUMPOBJ_SRCS = dumpobj.c rad50.c
DUMPOBJ_OBJS = $(DUMPOBJ_SRCS:.c=.o)
ALL_SRCS = $(MACRO11_SRCS) $(DUMPOBJ_SRCS)
all: macro11 dumpobj
tags: macro11 dumpobj
ctags *.c *.h
macro11: $(MACRO11_OBJS) Makefile
$(CC) $(CFLAGS) -o macro11 $(MACRO11_OBJS) -lm
dumpobj: $(DUMPOBJ_OBJS) Makefile
$(CC) $(CFLAGS) -o dumpobj $(DUMPOBJ_OBJS)
MACRO11_OBJS: Makefile
DUMPOBJ_OBJS: Makefile
clean:
-rm -f $(MACRO11_OBJS) $(DUMPOBJ_OBJS) macro11 dumpobj
macro11.o: macro11.c macro11.h rad50.h object.h stream2.h \
mlb.h util.h symbols.h
mlb.o: mlb.c rad50.h stream2.h mlb.h macro11.h util.h
mlb-rsx.o: mlb-rsx.c rad50.h stream2.h mlb.h macro11.h util.h
object.o: object.c rad50.h object.h
stream2.o: stream2.c macro11.h stream2.h
util.o: util.c util.h
rad50.o: rad50.c rad50.h
dumpobj.o: dumpobj.c rad50.h util.h
rad50.o: rad50.c rad50.h
# Since the only tests we have so far are for crashes,
# just try to assemble. Later, we will need expected/actual tests.
# Test that all options requiring a value bail out if it's not present.
argtests: macro11
@ for OPT in -e -d -m -p -o -l -ysl ; do \
./macro11 foo.mac $$OPT 2> /dev/null; \
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
echo " $$OPT missing value"; \
./macro11 foo.mac $$OPT -v 2> /dev/null; \
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
echo " $$OPT fol. by option"; \
done
@ ./macro11 foo.mac $$OPT -x -v 2> /dev/null; \
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
echo " -x must be the last option"
tests: macro11 argtests
@ ACTUAL=`./macro11 tests/test-undef.mac 2>&1`; \
if [ "tests/test-undef.mac:1: ***ERROR MACRO .TTYOU not found" == "$$ACTUAL" ]; then echo PASS; else echo FAIL; fi; \
echo " test-undef.mac"