shithub: scc

Download patch

ref: 7422cf29d5bf6b0b5b8c4089e7dd0607299c4d2f
parent: 76ca88468843aaf2a21a15f240d0dc37d5ae8eb6
author: Lucas Gabriel Vuotto <[email protected]>
date: Wed Aug 23 08:36:50 EDT 2017

Fix build in OpenBSD

$(LIB-OBJ) wasn't expanding because it was defined after the rule
libcc.a was used. The include of libdep.mk was added to the end
to avoid having the rule defined in it as the default rule in
the makefile, but with this change this is not a problem anymore.

Signed-off-by: Lucas Gabriel Vuotto <[email protected]>

--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -4,10 +4,11 @@
 # Makefile is only used as a template for makefile.
 # If you modify Makefile remember to run make dep
 
+LIBDIR    = ../lib/cc
 include ../config.mk
+include $(LIBDIR)/libdep.mk
 
 MOREFLAGS = -I../inc/$(STD)
-LIBDIR    = ../lib/cc
 
 OBJ = types.o decl.o lex.o error.o symbol.o main.o expr.o \
       code.o stmt.o cpp.o fold.o init.o builtin.o
@@ -34,4 +35,3 @@
 distclean: clean
 	rm -f makefile
 
-include ../lib/cc/libdep.mk
--- a/cc2/Makefile
+++ b/cc2/Makefile
@@ -4,10 +4,11 @@
 # Makefile is only used as a template for makefile.
 # If you modify Makefile remember to run make dep
 
+LIBDIR    = ../lib/cc
 include ../config.mk
+include $(LIBDIR)/libdep.mk
 
 MOREFLAGS = -I../inc/$(STD)
-LIBDIR    = ../lib/cc
 
 OBJ = main.o parser.o peep.o symbol.o node.o code.o optm.o
 HDR = cc2.h ../inc/$(STD)/cstd.h ../inc/cc.h
@@ -36,4 +37,3 @@
 distclean: clean
 	rm -f makefile
 
-include ../lib/cc/libdep.mk
--- a/driver/posix/Makefile
+++ b/driver/posix/Makefile
@@ -1,10 +1,10 @@
 # See LICENSE file for copyright and license details.
 .POSIX:
 
+LIBDIR    = ../../lib/cc
 include ../../config.mk
+include $(LIBDIR)/libdep.mk
 
-LIBDIR    = ../../lib/cc
-
 OBJ = scc.o
 HDR = config.h \
       ../../inc/cc.h \
@@ -43,4 +43,3 @@
 distclean: clean
 	rm -f config.h
 
-include ../../lib/cc/libdep.mk
--- a/lib/cc/Makefile
+++ b/lib/cc/Makefile
@@ -1,13 +1,13 @@
 # See LICENSE file for copyright and license details.
 .POSIX:
 
+LIBDIR = ./
 include ../../config.mk
+include libdep.mk
 
-LIBDIR = ./
-
 all: libcc.a
 
-libcc.a:
+libcc.a: $(LIB-OBJ)
 	ar $(ARFLAGS) $@ $?
 	ranlib $@
 
@@ -17,4 +17,3 @@
 	rm -f *.o *.a
 
 distclean: clean
-include libdep.mk
--- a/lib/cc/libdep.mk
+++ b/lib/cc/libdep.mk
@@ -6,5 +6,3 @@
           $(LIBDIR)/xmalloc.o \
           $(LIBDIR)/xrealloc.o \
           $(LIBDIR)/xstrdup.o \
-
-$(LIBDIR)/libcc.a: $(LIB-OBJ)