From 7fa0d31ec5c0be9dca84a03851b2d44f61527ec8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20B=C3=A9nard?= <eric@eukrea.com>
Date: Sun, 4 Dec 2011 16:01:04 +0100
Subject: [PATCH] GNUmakefile: add possibility to override variables
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

this is useful for cross compilation

Signed-off-by: Eric Bénard <eric@eukrea.com>
---
Upstream-Status: Inappropriate [embedded specific]
 src/libbsd/GNUmakefile |   10 +++++-----
 src/libmy/GNUmakefile  |   26 +++++++++++++-------------
 src/nhttpd/GNUmakefile |   12 ++++++------
 src/tools/GNUmakefile  |    8 ++++----
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/libbsd/GNUmakefile b/src/libbsd/GNUmakefile
index e2d01a3..b034bc6 100644
--- a/src/libbsd/GNUmakefile
+++ b/src/libbsd/GNUmakefile
@@ -1,12 +1,12 @@
-CCFLAGS = -O2 -pipe -Wall -Werror -Wstrict-prototypes -c
+CFLAGS := -O2 -pipe -Wall -Werror -Wstrict-prototypes -c
 
 libbsd.a:	strlcpy.o strlcat.o
-		ar -r libbsd.a strlcpy.o strlcat.o
-		ranlib libbsd.a
+		$(AR) -r libbsd.a strlcpy.o strlcat.o
+		$(RANLIB) libbsd.a
 
 strlcpy.o:	strlcpy.c
-		cc ${CCFLAGS} strlcpy.c
+		$(CC) $(CFLAGS) strlcpy.c
 strlcat.o:	strlcat.c
-		cc ${CCFLAGS} strlcat.c
+		$(CC) $(CFLAGS) strlcat.c
 clean:
 		rm -f libbsd.a *.o
diff --git a/src/libmy/GNUmakefile b/src/libmy/GNUmakefile
index ce90dd9..891ffea 100644
--- a/src/libmy/GNUmakefile
+++ b/src/libmy/GNUmakefile
@@ -1,30 +1,30 @@
-CCFLAGS = -O2 -Wall -Werror -Wstrict-prototypes -c
+CFLAGS := -O2 -Wall -Werror -Wstrict-prototypes -c
 
 libmy.a:	strcutl.o strcutw.o strcuts.o strcuti.o strcutf.o flog.o flogd.o fparse.o strlower.o strb64d.o
-		ar -r libmy.a strcutl.o strcutw.o strcuts.o strcuti.o strcutf.o flog.o flogd.o fparse.o strlower.o strb64d.o
-		ranlib libmy.a
+		$(AR) -r libmy.a strcutl.o strcutw.o strcuts.o strcuti.o strcutf.o flog.o flogd.o fparse.o strlower.o strb64d.o
+		$(RANLIB) libmy.a
 
 strcutl.o:	strcutl.c
-		cc ${CCFLAGS} strcutl.c
+		$(CC) $(CFLAGS) strcutl.c
 strcutw.o:	strcutw.c
-		cc ${CCFLAGS} strcutw.c
+		$(CC) $(CFLAGS) strcutw.c
 strcuts.o:	strcuts.c
-		cc ${CCFLAGS} strcuts.c
+		$(CC) $(CFLAGS) strcuts.c
 strcuti.o:	strcuti.c
-		cc ${CCFLAGS} strcuti.c
+		$(CC) $(CFLAGS) strcuti.c
 strcutf.o:	strcutf.c
-		cc ${CCFLAGS} strcutf.c
+		$(CC) $(CFLAGS) strcutf.c
 strlower.o:	strlower.c
-		cc ${CCFLAGS} strlower.c
+		$(CC) $(CFLAGS) strlower.c
 strb64d.o:	strb64d.c
-		cc ${CCFLAGS} strb64d.c
+		$(CC) $(CFLAGS) strb64d.c
 
 flog.o:		flog.c
-		cc ${CCFLAGS} flog.c
+		$(CC) $(CFLAGS) flog.c
 flogd.o:	flogd.c
-		cc ${CCFLAGS} flogd.c
+		$(CC) $(CFLAGS) flogd.c
 fparse.o:	fparse.c
-		cc ${CCFLAGS} fparse.c
+		$(CC) $(CFLAGS) fparse.c
 
 clean:
 		rm -f libmy.a *.o
diff --git a/src/nhttpd/GNUmakefile b/src/nhttpd/GNUmakefile
index f6d12de..9524911 100644
--- a/src/nhttpd/GNUmakefile
+++ b/src/nhttpd/GNUmakefile
@@ -1,18 +1,18 @@
-CCFLAGS = -O2 -pipe -Wall -Wstrict-prototypes -c
+CFLAGS := -O2 -pipe -Wall -Wstrict-prototypes -c
 
 nhttpd:	main.o http.o sys.o
-	cc -L../libmy -L../libbsd -o nhttpd main.o http.o sys.o -lmy -lbsd -lssl -lcrypt
-	strip nhttpd
+	$(CC) -L../libmy -L../libbsd -o nhttpd main.o http.o sys.o -lmy -lbsd -lssl -lcrypt
+#	$(STRIP) nhttpd
 	nroff -Tascii -c -mandoc nhttpd.8 > nhttpd.cat8
 
 main.o:	main.c
-	cc ${CCFLAGS} main.c
+	$(CC) $(CFLAGS) main.c
 
 http.o:	http.c
-	cc ${CCFLAGS} http.c
+	$(CC) $(CFLAGS) http.c
 
 sys.o:	sys.c
-	cc ${CCFLAGS} sys.c
+	$(CC) $(CFLAGS) sys.c
 
 clean:
 	rm -f nhttpd nhttpd.cat8 *.o
diff --git a/src/tools/GNUmakefile b/src/tools/GNUmakefile
index 15bea61..663ddb5 100644
--- a/src/tools/GNUmakefile
+++ b/src/tools/GNUmakefile
@@ -1,11 +1,11 @@
-CCFLAGS = -O2 -pipe -Wall -Werror -Wstrict-prototypes -c
+CCFLAGS := -O2 -pipe -Wall -Werror -Wstrict-prototypes
 
 crypt:		crypt.o
-		cc -o crypt crypt.o -lcrypt
-		strip crypt
+		$(CC) $(CFLAGS) -o crypt crypt.o -lcrypt
+#		$(STRIP) crypt
 
 crypt.o:	crypt.c
-		cc ${CCFLAGS} crypt.c
+		$(CC) $(CFLAGS) -c crypt.c
 
 clean:
 		rm -f crypt *.o
-- 
1.7.6.4

