scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 1a83b7b7311b8944a34d8e16ad9aa22aa7a4a051
parent bcf34c9b169850dd66471f5c79738e73d7813f26
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 14 Mar 2018 11:34:56 +0100

Merge branch 'make-changes'

Diffstat:
Mar/Makefile | 5-----
Mas/Makefile | 4----
Mcc1/Makefile | 5-----
Mcc2/Makefile | 5-----
Mdriver/posix/Makefile | 3---
Mld/Makefile | 7+------
Mlib/scc/Makefile | 2+-
Mlib/scc/libdep.mk | 19++++---------------
Alib/scc/objlst.mk | 16++++++++++++++++
Mnm/Makefile | 5-----
Mobjdump/Makefile | 4----
Mrules.mk | 10++++++++++
12 files changed, 32 insertions(+), 53 deletions(-)

diff --git a/ar/Makefile b/ar/Makefile @@ -1,7 +1,6 @@ .POSIX: PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk @@ -9,7 +8,6 @@ OBJ = main.o $(DRIVER)/driver.o MOREFLAGS = -I$(DRIVER) all: ar-$(DRIVER) - mkdir -p $(PROJECTDIR)/rootdir/bin cp ar-$(DRIVER) $(PROJECTDIR)/rootdir/bin/ar ar-$(DRIVER): $(OBJ) $(LIBDIR)/libscc.a @@ -19,9 +17,6 @@ main.o: $(PROJECTDIR)/inc/scc.h $(PROJECTDIR)/inc/ar.h $(DRIVER)/driver.o: $(DRIVER)/driver.h -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - main.o: $(DRIVER)/driver.h dep: diff --git a/as/Makefile b/as/Makefile @@ -1,7 +1,6 @@ .POSIX: PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk @@ -18,9 +17,6 @@ as: $(OBJ) myro.o: $(PROJECTDIR)/inc/myro.h -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - dep: ./gendep.sh $(TARGETS) diff --git a/cc1/Makefile b/cc1/Makefile @@ -4,7 +4,6 @@ # If you modify Makefile remember to run make dep PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk @@ -20,12 +19,8 @@ HDR = cc1.h \ $(PROJECTDIR)/inc/sysincludes.h all: - mkdir -p $(PROJECTDIR)/rootdir/libexec/scc/ cp cc1-* $(PROJECTDIR)/rootdir/libexec/scc/ -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - dep: ./gendep.sh $(TARGETS) diff --git a/cc2/Makefile b/cc2/Makefile @@ -4,7 +4,6 @@ # If you modify Makefile remember to run make dep PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk @@ -14,15 +13,11 @@ OBJ = main.o parser.o peep.o symbol.o node.o code.o optm.o HDR = cc2.h $(PROJECTDIR)/inc/$(STD)/cstd.h $(PROJECTDIR)/inc/scc.h all: - mkdir -p $(PROJECTDIR)/rootdir/libexec/scc/ cp cc2-* $(PROJECTDIR)/rootdir/libexec/scc/ dep: MKQBE=${MKQBE} ./gendep.sh $(TARGETS) -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - main.o: error.h error.h: cc2.h diff --git a/driver/posix/Makefile b/driver/posix/Makefile @@ -32,9 +32,6 @@ cpp: cpp.sh config.h chmod +x $$$$.sh && \ mv $$$$.sh $@ -$(LIBDIR)/libscc.a: - +cd $(LIBDIR) && $(MAKE) - clean: rm -f $(OBJ) rm -f scc diff --git a/ld/Makefile b/ld/Makefile @@ -1,22 +1,17 @@ .POSIX: PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk OBJ = main.o formats.o coff32.o all: ld - mkdir -p $(PROJECTDIR) cp ld $(PROJECTDIR)/rootdir/bin -ld: $(OBJ) +ld: $(OBJ) $(LIBDIR)/libscc.a $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@ -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - dep: $(PROJECTDIR)/mkdep.sh diff --git a/lib/scc/Makefile b/lib/scc/Makefile @@ -3,7 +3,7 @@ PROJECTDIR = ../.. LIBDIR = . include $(PROJECTDIR)/rules.mk -include libdep.mk +include objlst.mk all: libscc.a diff --git a/lib/scc/libdep.mk b/lib/scc/libdep.mk @@ -1,15 +1,4 @@ -LIB-OBJ = $(LIBDIR)/debug.o \ - $(LIBDIR)/die.o \ - $(LIBDIR)/newitem.o \ - $(LIBDIR)/xcalloc.o \ - $(LIBDIR)/xmalloc.o \ - $(LIBDIR)/xrealloc.o \ - $(LIBDIR)/xstrdup.o \ - $(LIBDIR)/alloc.o \ - $(LIBDIR)/casecmp.o \ - $(LIBDIR)/lunpack.o \ - $(LIBDIR)/lpack.o \ - $(LIBDIR)/bunpack.o \ - $(LIBDIR)/bpack.o \ - $(LIBDIR)/wmyro.o \ - $(LIBDIR)/rmyro.o \ +include $(LIBDIR)/objlst.mk + +$(LIBDIR)/libscc.a: $(LIB-OBJ) + +cd $(LIBDIR) && $(MAKE) diff --git a/lib/scc/objlst.mk b/lib/scc/objlst.mk @@ -0,0 +1,16 @@ + +LIB-OBJ = $(LIBDIR)/debug.o \ + $(LIBDIR)/die.o \ + $(LIBDIR)/newitem.o \ + $(LIBDIR)/xcalloc.o \ + $(LIBDIR)/xmalloc.o \ + $(LIBDIR)/xrealloc.o \ + $(LIBDIR)/xstrdup.o \ + $(LIBDIR)/alloc.o \ + $(LIBDIR)/casecmp.o \ + $(LIBDIR)/lunpack.o \ + $(LIBDIR)/lpack.o \ + $(LIBDIR)/bunpack.o \ + $(LIBDIR)/bpack.o \ + $(LIBDIR)/wmyro.o \ + $(LIBDIR)/rmyro.o \ diff --git a/nm/Makefile b/nm/Makefile @@ -1,22 +1,17 @@ .POSIX: PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk OBJ = main.o coff32.o formats.o all: nm - mkdir -p $(PROJECTDIR)/rootdir/bin cp nm $(PROJECTDIR)/rootdir/bin/nm nm: $(OBJ) $(LIBDIR)/libscc.a $(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@ -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - dep: $(PROJECTDIR)/mkdep.sh diff --git a/objdump/Makefile b/objdump/Makefile @@ -1,7 +1,6 @@ .POSIX: PROJECTDIR = .. -LIBDIR = $(PROJECTDIR)/lib/scc include $(PROJECTDIR)/rules.mk include $(LIBDIR)/libdep.mk @@ -14,9 +13,6 @@ objdump: $(OBJ) $(LIBDIR)/libscc.a main.o: $(PROJECTDIR)/inc/scc.h $(PROJECTDIR)/inc/myro.h $(PROJECTDIR)/inc/arg.h -$(LIBDIR)/libscc.a: $(LIB-OBJ) - +cd $(LIBDIR) && $(MAKE) - dep: clean: rm -f objdump *.o diff --git a/rules.mk b/rules.mk @@ -1,6 +1,7 @@ include $(PROJECTDIR)/config.mk INCDIR = $(PROJECTDIR)/inc/ +LIBDIR = $(PROJECTDIR)/lib/scc SCC_CFLAGS = $(MOREFLAGS) \ $(SYSCFLAGS) \ @@ -27,3 +28,12 @@ FORALL = +@set -e ;\ .c: $(CC) $(SCC_CFLAGS) $(SCC_LDFLAGS) -o $@ $< + + +all: $(PROJECTDIR)/rootdir/bin $(PROJECTDIR)/rootdir/libexec/scc + +$(PROJECTDIR)/rootdir/bin: + mkdir -p $(PROJECTDIR)/rootdir/bin + +$(PROJECTDIR)/rootdir/libexec/scc: + mkdir -p $(PROJECTDIR)/rootdir/libexec/scc