shithub: scc

Download patch

ref: 58657a9d91419f28cf3bbadf01528c2a3735a488
parent: 8d25c7aef545efc77a25e9511df145ccba20087d
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Tue Mar 13 19:57:10 EDT 2018

Move rootdir creation to rules.mk

We avoid writing the same line in every Makefile

--- a/ar/Makefile
+++ b/ar/Makefile
@@ -8,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
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -19,7 +19,6 @@
       $(PROJECTDIR)/inc/sysincludes.h
 
 all:
-	mkdir -p $(PROJECTDIR)/rootdir/libexec/scc/
 	cp cc1-* $(PROJECTDIR)/rootdir/libexec/scc/
 
 dep:
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -13,7 +13,6 @@
 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:
--- a/ld/Makefile
+++ b/ld/Makefile
@@ -7,7 +7,6 @@
 OBJ = main.o formats.o coff32.o
 
 all: ld
-	mkdir -p $(PROJECTDIR)/rootdir/bin
 	cp ld $(PROJECTDIR)/rootdir/bin
 
 ld: $(OBJ) $(LIBDIR)/libscc.a
--- a/nm/Makefile
+++ b/nm/Makefile
@@ -7,7 +7,6 @@
 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
--- a/rules.mk
+++ b/rules.mk
@@ -30,4 +30,10 @@
 	$(CC) $(SCC_CFLAGS) $(SCC_LDFLAGS) -o $@ $<
 
 
-all:
+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