[hackers] [scc] Add total compability to the Makefiles || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 16 Jul 2015 12:33:56 +0200 (CEST)

commit c7b52bd47910e2c14bc19422d14c432d20d92cce
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Jul 16 08:09:06 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Thu Jul 16 08:09:06 2015 +0200

    Add total compability to the Makefiles
    
    With .POSIX target we get that the user
    without environment will execute c99. If the user
    has no c99, then it can source env.sh or execute
    build.sh.

diff --git a/Makefile b/Makefile
index 76176de..cfdf573 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -6,3 +6,5 @@ all clean:
         do \
                 (cd $$i && $(MAKE) $_AT_) ;\
         done
+
+.POSIX:
diff --git a/build.sh b/build.sh
index e280799..dea6489 100755
--- a/build.sh
+++ b/build.sh
_AT_@ -1,11 +1,5 @@
 #!/bin/sh
 
-case `uname` in
-Plan9)
- CFLAGS="-D_SUSV2_SOURCE -DNBOOL"
- export CFLAGS
- ;;
-esac
-
+source env.sh
 make $_AT_
 
diff --git a/cc1/Makefile b/cc1/Makefile
index ed8ac07..47e9c09 100644
--- a/cc1/Makefile
+++ b/cc1/Makefile
_AT_@ -1,9 +1,10 @@
-CFLAGS = -ansi
 OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
         code.o stmt.o cpp.o
 
 all: cc1
 
+.POSIX:
+
 $(OBJS) : cc1.h ../inc/cc.h ../inc/sizes.h
 
 cc1: $(OBJS) ../lib/libcc.a
diff --git a/cc2/Makefile b/cc2/Makefile
index 2e364fa..1324c82 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -5,6 +5,8 @@ LIBS = -lcc
 
 all: cc2
 
+.POSIX:
+
 $(OBJS): ../inc/cc.h ../inc/sizes.h cc2.h
 main.o: error.h
 
diff --git a/env.sh b/env.sh
new file mode 100755
index 0000000..30f3b88
--- /dev/null
+++ b/env.sh
_AT_@ -0,0 +1,23 @@
+#!/bin/sh
+
+case `uname` in
+Plan9)
+ CFLAGS="-D_SUSV2_SOURCE -DNBOOL"
+ export CFLAGS
+ ;;
+*)
+ case x$CC in
+ xc99)
+ ;;
+ x|xgcc)
+ CC=gcc
+ CFLAGS=-std=c99
+ export CFLAGS CC
+ ;;
+ *)
+ echo You need a c99 compiler for this program 2>&1
+ exit
+ ;;
+ esac
+ ;;
+esac
diff --git a/lib/Makefile b/lib/Makefile
index 586c8b9..3e3a0c0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
_AT_@ -3,6 +3,8 @@ OBJS = die.o xcalloc.o xmalloc.o xrealloc.o xstrdup.o
 
 all: libcc.a
 
+.POSIX:
+
 libcc.a: $(OBJS)
         ar r $_AT_ $?
 
Received on Thu Jul 16 2015 - 12:33:56 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 16 2015 - 12:36:09 CEST