mirror of
https://github.com/open-simh/simtools.git
synced 2026-04-25 19:51:23 +00:00
Automatic dependency generation with gcc -MM.
This commit is contained in:
40
Makefile
40
Makefile
@@ -30,22 +30,12 @@ macro11: $(MACRO11_OBJS) Makefile
|
|||||||
dumpobj: $(DUMPOBJ_OBJS) Makefile
|
dumpobj: $(DUMPOBJ_OBJS) Makefile
|
||||||
$(CC) $(CFLAGS) -o dumpobj $(DUMPOBJ_OBJS)
|
$(CC) $(CFLAGS) -o dumpobj $(DUMPOBJ_OBJS)
|
||||||
|
|
||||||
MACRO11_OBJS: Makefile
|
$(MACRO11_OBJS): Makefile
|
||||||
DUMPOBJ_OBJS: Makefile
|
$(DUMPOBJ_OBJS): Makefile
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f $(MACRO11_OBJS) $(DUMPOBJ_OBJS) macro11 dumpobj
|
-rm -f $(MACRO11_OBJS) $(DUMPOBJ_OBJS) macro11 dumpobj
|
||||||
|
-rm -f *.d
|
||||||
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,
|
# Since the only tests we have so far are for crashes,
|
||||||
# just try to assemble. Later, we will need expected/actual tests.
|
# just try to assemble. Later, we will need expected/actual tests.
|
||||||
@@ -54,17 +44,27 @@ rad50.o: rad50.c rad50.h
|
|||||||
argtests: macro11
|
argtests: macro11
|
||||||
@ for OPT in -e -d -m -p -o -l -ysl ; do \
|
@ for OPT in -e -d -m -p -o -l -ysl ; do \
|
||||||
./macro11 foo.mac $$OPT 2> /dev/null; \
|
./macro11 foo.mac $$OPT 2> /dev/null; \
|
||||||
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
|
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
|
||||||
echo " $$OPT missing value"; \
|
echo " $$OPT missing value"; \
|
||||||
./macro11 foo.mac $$OPT -v 2> /dev/null; \
|
./macro11 foo.mac $$OPT -v 2> /dev/null; \
|
||||||
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
|
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
|
||||||
echo " $$OPT fol. by option"; \
|
echo " $$OPT fol. by option"; \
|
||||||
done
|
done
|
||||||
@ ./macro11 foo.mac $$OPT -x -v 2> /dev/null; \
|
@ ./macro11 foo.mac $$OPT -x -v 2> /dev/null; \
|
||||||
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
|
if (( $$? == 1 )); then echo PASS; else echo FAIL; fi; \
|
||||||
echo " -x must be the last option"
|
echo " -x must be the last option"
|
||||||
|
|
||||||
tests: macro11 argtests
|
tests: macro11 argtests
|
||||||
@ ACTUAL=`./macro11 tests/test-undef.mac 2>&1`; \
|
@ 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; \
|
if [ "tests/test-undef.mac:1: ***ERROR MACRO .TTYOU not found" == "$$ACTUAL" ]; then echo PASS; else echo FAIL; fi; \
|
||||||
echo " test-undef.mac"
|
echo " test-undef.mac"
|
||||||
|
|
||||||
|
# Automatic dependency generation
|
||||||
|
|
||||||
|
-include $(ALL_SRCS:.c=.d)
|
||||||
|
|
||||||
|
%.d: %.c
|
||||||
|
@set -e; rm -f $@; \
|
||||||
|
$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
|
||||||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||||||
|
rm -f $@.$$$$
|
||||||
|
|||||||
Reference in New Issue
Block a user