shithub: scc

Download patch

ref: b5a123a0a108eef52d9e7df25e63707a55a32b99
parent: 95232a91309714fde82840811c7bae6c53dd5778
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Jan 25 07:08:58 EST 2016

Make Makefiles even more user friendly

This commit uses a more clean name for scc flags,
and combine them with use flags, which simplifies
all the other rules in the project.

--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -10,7 +10,7 @@
 $(OBJS) : cc1.h ../inc/cc.h ../inc/sizes.h arch/$(ARCH)/arch.h
 
 cc1: $(OBJS) ../lib/libcc.a
-	$(CC) $(SLDFLAGS) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
+	$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
 
 cpp: cc1
 	ln -f cc1 cpp
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -16,7 +16,7 @@
 	awk -f generror cc2.h > $$$$.h && mv $$$$.h $@
 
 cc2: $(OBJS) ../lib/libcc.a
-	$(CC) $(SLDFLAGS) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
+	$(CC) $(SCC_LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
 
 clean:
 	rm -f $(OBJS)
--- a/config.mk
+++ b/config.mk
@@ -14,11 +14,11 @@
 # AR = ar
 
 # for Plan9 add -D_SUSV2_SOURCE -DNBOOL
-SCFLAGS = -DNDEBUG -Iarch/$(ARCH) -DPREFIX=\""$(PREFIX)"\"
-SLDFLAGS  =
+SCC_CFLAGS = -DNDEBUG -Iarch/$(ARCH) -DPREFIX=\""$(PREFIX)"\" $(CFLAGS)
+SCC_LDFLAGS  = $(LDFLAGS)
 
 .c.o:
-	$(CC) $(SCFLAGS) $(CFLAGS) -o $@ -c $<
+	$(CC) $(SCC_CFLAGS) -o $@ -c $<
 
 .c:
-	$(CC) $(SCFLAGS) $(CFLAGS) -o $@ $<
+	$(CC) $(SCC_CFLAGS) $(SCC_LDFLAGS) -o $@ $<