ref: 8d25c7aef545efc77a25e9511df145ccba20087d
parent: 99bb172e34500445d1969971eb77bff53ac9cb6e
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Mar 13 19:40:24 EDT 2018
Move the lib generation rule to libdep.mk
--- a/ar/Makefile
+++ b/ar/Makefile
@@ -1,7 +1,6 @@
.POSIX:
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -18,9 +17,6 @@
main.o: $(PROJECTDIR)/inc/scc.h $(PROJECTDIR)/inc/ar.h
$(DRIVER)/driver.o: $(DRIVER)/driver.h
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
main.o: $(DRIVER)/driver.h
--- a/as/Makefile
+++ b/as/Makefile
@@ -1,7 +1,6 @@
.POSIX:
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -17,9 +16,6 @@
$(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
myro.o: $(PROJECTDIR)/inc/myro.h
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
dep:
./gendep.sh $(TARGETS)
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -4,7 +4,6 @@
# If you modify Makefile remember to run make dep
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -22,9 +21,6 @@
all:
mkdir -p $(PROJECTDIR)/rootdir/libexec/scc/
cp cc1-* $(PROJECTDIR)/rootdir/libexec/scc/
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
dep:
./gendep.sh $(TARGETS)
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -4,7 +4,6 @@
# If you modify Makefile remember to run make dep
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -19,9 +18,6 @@
dep:
MKQBE=${MKQBE} ./gendep.sh $(TARGETS)
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
main.o: error.h
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -32,9 +32,6 @@
chmod +x $$$$.sh && \
mv $$$$.sh $@
-$(LIBDIR)/libscc.a:
- +cd $(LIBDIR) && $(MAKE)
-
clean:
rm -f $(OBJ)
rm -f scc
--- a/ld/Makefile
+++ b/ld/Makefile
@@ -1,7 +1,6 @@
.POSIX:
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -8,14 +7,11 @@
OBJ = main.o formats.o coff32.o
all: ld
- mkdir -p $(PROJECTDIR)
+ mkdir -p $(PROJECTDIR)/rootdir/bin
cp ld $(PROJECTDIR)/rootdir/bin
-ld: $(OBJ)
+ld: $(OBJ) $(LIBDIR)/libscc.a
$(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
dep:
$(PROJECTDIR)/mkdep.sh
--- a/lib/scc/Makefile
+++ b/lib/scc/Makefile
@@ -3,7 +3,7 @@
PROJECTDIR = ../..
LIBDIR = .
include $(PROJECTDIR)/rules.mk
-include libdep.mk
+include objlst.mk
all: libscc.a
--- a/lib/scc/libdep.mk
+++ b/lib/scc/libdep.mk
@@ -1,15 +1,4 @@
-LIB-OBJ = $(LIBDIR)/debug.o \
- $(LIBDIR)/die.o \
- $(LIBDIR)/newitem.o \
- $(LIBDIR)/xcalloc.o \
- $(LIBDIR)/xmalloc.o \
- $(LIBDIR)/xrealloc.o \
- $(LIBDIR)/xstrdup.o \
- $(LIBDIR)/alloc.o \
- $(LIBDIR)/casecmp.o \
- $(LIBDIR)/lunpack.o \
- $(LIBDIR)/lpack.o \
- $(LIBDIR)/bunpack.o \
- $(LIBDIR)/bpack.o \
- $(LIBDIR)/wmyro.o \
- $(LIBDIR)/rmyro.o \
+include $(LIBDIR)/objlst.mk
+
+$(LIBDIR)/libscc.a: $(LIB-OBJ)
+ +cd $(LIBDIR) && $(MAKE)
--- /dev/null
+++ b/lib/scc/objlst.mk
@@ -1,0 +1,16 @@
+
+LIB-OBJ = $(LIBDIR)/debug.o \
+ $(LIBDIR)/die.o \
+ $(LIBDIR)/newitem.o \
+ $(LIBDIR)/xcalloc.o \
+ $(LIBDIR)/xmalloc.o \
+ $(LIBDIR)/xrealloc.o \
+ $(LIBDIR)/xstrdup.o \
+ $(LIBDIR)/alloc.o \
+ $(LIBDIR)/casecmp.o \
+ $(LIBDIR)/lunpack.o \
+ $(LIBDIR)/lpack.o \
+ $(LIBDIR)/bunpack.o \
+ $(LIBDIR)/bpack.o \
+ $(LIBDIR)/wmyro.o \
+ $(LIBDIR)/rmyro.o \
--- a/nm/Makefile
+++ b/nm/Makefile
@@ -1,7 +1,6 @@
.POSIX:
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -13,9 +12,6 @@
nm: $(OBJ) $(LIBDIR)/libscc.a
$(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
dep:
$(PROJECTDIR)/mkdep.sh
--- a/objdump/Makefile
+++ b/objdump/Makefile
@@ -1,7 +1,6 @@
.POSIX:
PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
include $(PROJECTDIR)/rules.mk
include $(LIBDIR)/libdep.mk
@@ -13,9 +12,6 @@
$(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
main.o: $(PROJECTDIR)/inc/scc.h $(PROJECTDIR)/inc/myro.h $(PROJECTDIR)/inc/arg.h
-
-$(LIBDIR)/libscc.a: $(LIB-OBJ)
- +cd $(LIBDIR) && $(MAKE)
dep:
clean:
--- a/rules.mk
+++ b/rules.mk
@@ -1,6 +1,7 @@
include $(PROJECTDIR)/config.mk
INCDIR = $(PROJECTDIR)/inc/
+LIBDIR = $(PROJECTDIR)/lib/scc
SCC_CFLAGS = $(MOREFLAGS) \
$(SYSCFLAGS) \
@@ -27,3 +28,6 @@
.c:
$(CC) $(SCC_CFLAGS) $(SCC_LDFLAGS) -o $@ $<
+
+
+all: