commit 52b35f6e7e1a3dd0f4eff972451c99f88b80f618
parent a9bc8aa095aabbb77bc77d990cc410c65cae19ba
Author: pancake@dazo <unknown>
Date:   Mon, 14 Dec 2009 01:39:28 +0100
* Handle CFLAGS/LDFLAGS in Makefile
  - Build with -O2 -Wall by default
* Clean up some warnings
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -4,6 +4,7 @@ PREFIX?=/usr
 VERSION=0.1
 USER=root
 GROUP=root
+CFLAGS?=-O2 -Wall
 
 all: config.h sup
 
@@ -11,10 +12,10 @@ config.h:
 	cp config.def.h config.h
 
 sup.o: config.h sup.c
-	${CC} -c sup.c
+	${CC} ${CFLAGS} -c sup.c
 
 sup: sup.o
-	${CC} sup.o -o sup
+	${CC} ${LDFLAGS} sup.o -o sup
 
 clean:
 	rm -f sup.o sup
diff --git a/sup.c b/sup.c
@@ -1,7 +1,8 @@
 /* pancake <nopcode.org> -- Copyleft 2009 */
 
-#include <stdio.h>
 #include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
 #include <string.h>
 #include <sys/stat.h>
 
@@ -23,7 +24,6 @@ static int die(int ret, const char *str) {
 }
 
 int main(int argc, char **argv) {
-	char *cmd;
 	int i, uid, gid, ret;
 
 	if (argc < 2 || !strcmp (argv[1], "-h"))