[hackers] [scc] Make Makefiles more user friendly || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 25 Jan 2016 11:00:40 +0100 (CET)

commit 6658e6edcecad1c26e6b0cfcd06ad08992481356
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Jan 25 10:43:25 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Jan 25 10:58:37 2016 +0100

    Make Makefiles more user friendly
    
    CFLAGS and LDFLAGS are user variables. If we use a new set of defined flags
    we allow to the user to modify the behaviour of the Makefile using
    environment variables.

diff --git a/cc1/Makefile b/cc1/Makefile
index 573bd65..9cde066 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -10,7 +10,7 @@ all: cc1
 $(OBJS) : cc1.h ../inc/cc.h ../inc/sizes.h arch/$(ARCH)/arch.h
 
 cc1: $(OBJS) ../lib/libcc.a
- $(CC) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
+ $(CC) $(SLDFLAGS) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
 
 cpp: cc1
         ln -f cc1 cpp
_AT_@ -21,4 +21,3 @@ test:
 clean:
         rm -f $(OBJS)
         rm -f cc1 cpp
-
diff --git a/cc2/Makefile b/cc2/Makefile
index 630b294..febe44c 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -16,7 +16,7 @@ error.h: cc2.h
         awk -f generror cc2.h > $$$$.h && mv $$$$.h $_AT_
 
 cc2: $(OBJS) ../lib/libcc.a
- $(CC) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
+ $(CC) $(SLDFLAGS) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
 
 clean:
         rm -f $(OBJS)
diff --git a/config.mk b/config.mk
index 77c105d..4656b21 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -10,10 +10,15 @@ PREFIX = $(HOME)
 MANPREFIX = ${PREFIX}/share/man
 
 # if your system is not POSIX maybe you want to use cc or gcc
-CC = c99
-LD = $(CC)
-AR = ar
+# CC = c99
+# AR = ar
 
 # for Plan9 add -D_SUSV2_SOURCE -DNBOOL
-CFLAGS = -DNDEBUG -Iarch/$(ARCH) -DPREFIX=\""$(PREFIX)"\"
-LDFLAGS = -s
+SCFLAGS = -DNDEBUG -Iarch/$(ARCH) -DPREFIX=\""$(PREFIX)"\"
+SLDFLAGS = -s
+
+.c.o:
+ $(CC) $(SCFLAGS) $(CFLAGS) -o $_AT_ -c $<
+
+.c:
+ $(CC) $(SCFLAGS) $(CFLAGS) -o $_AT_ $<
Received on Mon Jan 25 2016 - 11:00:40 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 25 2016 - 11:12:39 CET