ref: c7b52bd47910e2c14bc19422d14c432d20d92cce
parent: ede7ba5d7698410287308633d191039d7e795092
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jul 16 04:09:06 EDT 2015
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.
--- a/Makefile
+++ b/Makefile
@@ -6,3 +6,5 @@
do \
(cd $$i && $(MAKE) $@) ;\
done
+
+.POSIX:
--- a/build.sh
+++ b/build.sh
@@ -1,11 +1,5 @@
#!/bin/sh
-case `uname` in
-Plan9)
- CFLAGS="-D_SUSV2_SOURCE -DNBOOL"
- export CFLAGS
- ;;
-esac
-
+source env.sh
make $@
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -1,8 +1,9 @@
-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
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -5,6 +5,8 @@
all: cc2
+.POSIX:
+
$(OBJS): ../inc/cc.h ../inc/sizes.h cc2.h
main.o: error.h
--- /dev/null
+++ b/env.sh
@@ -1,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
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -3,6 +3,8 @@
all: libcc.a
+.POSIX:
+
libcc.a: $(OBJS)
ar r $@ $?