shithub: scc

Download patch

ref: 06ee05139a10abc443176c37ac2de9c4993f237f
parent: aaf5ff88b71d5e589da7245c942c4a7fa83ff983
parent: 58657a9d91419f28cf3bbadf01528c2a3735a488
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed Mar 14 07:34:56 EDT 2018

Merge branch 'make-changes'

--- a/ar/Makefile
+++ b/ar/Makefile
@@ -1,7 +1,6 @@
 .POSIX:
 
 PROJECTDIR = ..
-LIBDIR = $(PROJECTDIR)/lib/scc
 include $(PROJECTDIR)/rules.mk
 include $(LIBDIR)/libdep.mk
 
@@ -9,7 +8,6 @@
 MOREFLAGS = -I$(DRIVER)
 
 all: ar-$(DRIVER)
-	mkdir -p $(PROJECTDIR)/rootdir/bin
 	cp ar-$(DRIVER) $(PROJECTDIR)/rootdir/bin/ar
 
 ar-$(DRIVER): $(OBJ) $(LIBDIR)/libscc.a
@@ -18,9 +16,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
@@ -20,11 +19,7 @@
       $(PROJECTDIR)/inc/sysincludes.h
 
 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
 
@@ -14,14 +13,10 @@
 HDR = cc2.h $(PROJECTDIR)/inc/$(STD)/cstd.h $(PROJECTDIR)/inc/scc.h
 
 all:
-	mkdir -p $(PROJECTDIR)/rootdir/libexec/scc/
 	cp cc2-* $(PROJECTDIR)/rootdir/libexec/scc/
 
 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,10 @@
 OBJ = main.o formats.o coff32.o
 
 all: ld
-	mkdir -p $(PROJECTDIR)
 	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
 
@@ -8,14 +7,10 @@
 OBJ       = main.o coff32.o formats.o
 
 all: nm
-	mkdir -p $(PROJECTDIR)/rootdir/bin
 	cp nm $(PROJECTDIR)/rootdir/bin/nm
 
 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,12 @@
 
 .c:
 	$(CC) $(SCC_CFLAGS) $(SCC_LDFLAGS) -o $@ $<
+
+
+all: $(PROJECTDIR)/rootdir/bin $(PROJECTDIR)/rootdir/libexec/scc
+
+$(PROJECTDIR)/rootdir/bin:
+	mkdir -p $(PROJECTDIR)/rootdir/bin
+
+$(PROJECTDIR)/rootdir/libexec/scc:
+	mkdir -p $(PROJECTDIR)/rootdir/libexec/scc