ref: e4fb950f7f36da741e55025fd564a31a37ee4b06
parent: 3f605cf71d9fa11b487c97dee9900d19ad8ae69b
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Aug 18 04:22:00 EDT 2018
[inc] Add incdep.mk This makefile simplifies tracking the system include dependencies.
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -3,6 +3,7 @@
PROJECTDIR = ../..
include $(PROJECTDIR)/rules.mk
include $(LIBSCC)/libdep.mk
+include $(INCDIR)/incdep.mk
# SYSLST is a list of backend-arch-abi-sys. First
# element of the list becomes the default target
@@ -10,9 +11,6 @@
SYSLST = amd64-sysv-linux-elf z80-scc-none-none \
i386-sysv-linux-elf amd64-sysv-openbsd-elf
-SYSHDR = $(INCDIR)/ldflags.h $(INCDIR)/syscrts.h \
- $(INCDIR)/sysincludes.h $(INCDIR)/syslibs.h
-
TARGETS = $(BINDIR)/scc $(BINDIR)/scpp
all: $(TARGETS)
@@ -22,9 +20,6 @@
$(BINDIR)/scpp: cpp
cp cpp $@
-
-$(SYSHDR):
- +@cd $(INCDIR) && $(MAKE)
scc: scc.o $(LIBSCC)/libscc.a
$(CC) $(SCC_LDFLAGS) scc.o -lscc -o $@
--- a/inc/Makefile
+++ b/inc/Makefile
@@ -3,32 +3,31 @@
PROJECTDIR = ..
include $(PROJECTDIR)/rules.mk
+include inclst.mk
-HDR = ldflags.h syscrts.h sysincludes.h syslibs.h
-
all: config
-config: $(HDR)
+config: $(SYSHDR)
-ldflags.h:
+$(INCDIR)/ldflags.h:
rm -f $@ ; \
trap "rm -f $$$$.h" 0 2 3; \
cat < ldflags.def.h > $$$$.h; \
mv $$$$.h $@
-syscrts.h:
+$(INCDIR)/syscrts.h:
rm -f $@ ; \
trap "rm -f $$$$.h" 0 2 3; \
sed 's,PREFIX,"$(PREFIX)",g' < syscrts.def.h > $$$$.h && \
mv $$$$.h $@
-sysincludes.h:
+$(INCDIR)/sysincludes.h:
rm -f $@ ; \
trap "rm -f $$$$.h" 0 2 3; \
sed 's,PREFIX,"$(PREFIX)",g' < sysincludes.def.h > $$$$.h && \
mv $$$$.h $@
-syslibs.h:
+$(INCDIR)/syslibs.h:
rm -f $@ ; \
trap "rm -f $$$$.h" 0 2 3; \
sed 's,PREFIX,"$(PREFIX)",g' < syslibs.def.h > $$$$.h && \
@@ -35,4 +34,4 @@
mv $$$$.h $@
distclean:
- rm -f $(HDR)
+ rm -f $(SYSHDR)
--- a/ld/Makefile
+++ b/ld/Makefile
@@ -3,6 +3,7 @@
PROJECTDIR = ..
include $(PROJECTDIR)/rules.mk
include $(LIBSCC)/libdep.mk
+include $(LIBCOFF32)/libdep.mk
OBJ = main.o coff32.o obj.o
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -4,7 +4,7 @@
include $(PROJECTDIR)/rules.mk
-DIRS = scc
+DIRS = scc coff32
all: $(DIRS)
--- a/lib/scc/libdep.mk
+++ b/lib/scc/libdep.mk
@@ -1,4 +1,4 @@
include $(LIBSCC)/objlst.mk
$(LIBSCC)/libscc.a: $(LIBSCC-OBJ)
- +cd $(LIBSCC) && $(MAKE)
+ +@cd $(LIBSCC) && $(MAKE)