[hackers] [scc] Improve error.h target in cc2/Makefile || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 20 Jul 2015 08:23:25 +0200 (CEST)

commit 58a6c79cc36af196485e291e0d5599f351653a21
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon Jul 20 08:07:12 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon Jul 20 08:07:12 2015 +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.

diff --git a/cc2/Makefile b/cc2/Makefile
index c406c4a..dbb1e52 100644
--- a/cc2/Makefile
+++ b/cc2/Makefile
_AT_@ -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:
_AT_@ -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 > $_AT_
-
+ rm -f $_AT_; trap 'rm -f $$$$.h' EXIT INT QUIT
+ awk -f generror cc2.h > $$$$.h && mv $$$$.h $_AT_
+
 cc2: $(OBJS) ../lib/libcc.a
- $(CC) -L../lib $(LDFLAGS) $(OBJS) $(LIBS) -o $_AT_
+ $(CC) $(LDFLAGS) $(OBJS) ../lib/libcc.a -o $_AT_
 
 clean:
         rm -f $(OBJS)
Received on Mon Jul 20 2015 - 08:23:25 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 20 2015 - 08:24:12 CEST