commit 58a6c79cc36af196485e291e0d5599f351653a21
parent c6d99ef3b76340791a0e68a8521277599cd1b690
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 20 Jul 2015 08:07:12 +0200
Improve error.h target in cc2/Makefile
This target is generated using a redirection, so a trap
alike rule is needed in order to ensure that the generated
file is correct.
LIB variable is also removed and direct library path is
used instead.
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/cc2/Makefile b/cc2/Makefile
@@ -2,8 +2,6 @@ include ../config.mk
OBJS = main.o parser.o cgen.o code.o optm.o peep.o
-LIBS = -lcc
-
all: cc2
.POSIX:
@@ -12,10 +10,11 @@ $(OBJS): ../inc/cc.h ../inc/sizes.h cc2.h
main.o: error.h
error.h: cc2.h
- awk -f generror cc2.h > $@
-
+ rm -f $@; trap 'rm -f $$$$.h' EXIT INT QUIT
+ awk -f generror cc2.h > $$$$.h && mv $$$$.h $@
+
cc2: $(OBJS) ../lib/libcc.a
- $(CC) -L../lib $(LDFLAGS) $(OBJS) $(LIBS) -o $@
+ $(CC) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $@
clean:
rm -f $(OBJS)