From c6313893bf0b70db2d3045310f47c26915af75ef Mon Sep 17 00:00:00 2001 From: "Roberto E. Vargas Caballero" Date: Sun, 11 Feb 2018 22:07:53 +0000 Subject: [PATCH] Make the Makefiles more portable - BSD make doesn't support the GNU extensions, and in that systems the GNU make is called gmake. Seeting the value of MAKE directly to make break the compilation in that systems. - In the same way, in BSD systems yacc is not aliased to byacc, and that explicit rule is not needed at all because POSIX make already has a default rule to generate c files from y files. --- Applications/MWC/cmd/Makefile.6502 | 4 +--- Applications/MWC/cmd/Makefile.68000 | 4 +--- Applications/MWC/cmd/Makefile.6809 | 4 +--- Applications/MWC/cmd/Makefile.z80 | 4 +--- Kernel/Makefile | 5 +---- Kernel/cpu-z80/image.mk | 6 +++--- Kernel/platform-msx2/image.mk | 2 +- Kernel/tools/findsdcc | 2 +- Library/libs/Makefile.z80 | 1 - 9 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Applications/MWC/cmd/Makefile.6502 b/Applications/MWC/cmd/Makefile.6502 index 97264fc3..c134e271 100644 --- a/Applications/MWC/cmd/Makefile.6502 +++ b/Applications/MWC/cmd/Makefile.6502 @@ -8,7 +8,7 @@ ASM_OPT = -o CRT0 = ../../../Library/libs/crt0_6502.o CRT0NS = ../../../Library/libs/crt0nostdio_6502.o -.SUFFIXES: .c .o +.SUFFIXES: .c .o .y SRC = ac.c almanac.c at.c col.c cron.c deroff.c ed.c find.c make.c \ moo.c pr.c tar.c ttt.c calendar.c m4.c @@ -24,10 +24,8 @@ APPSNS = $(OBJNS:.o=) all: $(APPS) $(APPSNS) sizes expr.c: expr.y - byacc -o expr.c expr.y find.c: find.y - byacc -o find.c find.y $(APPS): %: %.o $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $^ c6502.lib -m $@.map diff --git a/Applications/MWC/cmd/Makefile.68000 b/Applications/MWC/cmd/Makefile.68000 index 79275389..c1fe0c39 100644 --- a/Applications/MWC/cmd/Makefile.68000 +++ b/Applications/MWC/cmd/Makefile.68000 @@ -12,7 +12,7 @@ CRT0NS = ../../../Library/libs/crt0nostdio_68000.o # For now while we get going. Really we want to use some kind of elf2zmagic # with relocs. ELF2FUZIX = elf2flt -.SUFFIXES: .c .o +.SUFFIXES: .c .o .y SRCS = ac.c almanac.c at.c calendar.c col.c cron.c deroff.c ed.c expr.c find.c m4.c make.c moo.c pr.c tar.c test.c ttt.c units.c @@ -29,10 +29,8 @@ $(APPS): %: %.o $(ELF2FUZIX) -o $@ $@.bin expr.c: expr.y - byacc -o expr.c expr.y find.c: find.y - byacc -o find.c find.y size.report: $(APPS) ls -l $^ > $@ diff --git a/Applications/MWC/cmd/Makefile.6809 b/Applications/MWC/cmd/Makefile.6809 index 6f7169a4..47f25c3d 100644 --- a/Applications/MWC/cmd/Makefile.6809 +++ b/Applications/MWC/cmd/Makefile.6809 @@ -11,7 +11,7 @@ LINKER_OPT += --script=../../util/$(TARGET).link ASM_OPT = -o CRT0 = ../../../Library/libs/crt0_6809.o -.SUFFIXES: .c .o +.SUFFIXES: .c .o .y SRCS = ac.c almanac.c at.c calendar.c col.c cron.c deroff.c ed.c expr.c find.c m4.c make.c moo.c pr.c tar.c test.c ttt.c units.c du.c @@ -28,10 +28,8 @@ $(APPS): %: %.o $(LINKER) -o $@ $(LINKER_OPT) $^ expr.c: expr.y - byacc -o expr.c expr.y find.c: find.y - byacc -o find.c find.y size.report: $(APPS) ls -l $^ > $@ diff --git a/Applications/MWC/cmd/Makefile.z80 b/Applications/MWC/cmd/Makefile.z80 index 03a412c7..206cf4d5 100644 --- a/Applications/MWC/cmd/Makefile.z80 +++ b/Applications/MWC/cmd/Makefile.z80 @@ -9,7 +9,7 @@ PLATFORM = PROGLOAD=`(cat ../../Kernel/platform/config.h; echo PROGLOAD) | cpp -E | tail -n1` -.SUFFIXES: .c .rel +.SUFFIXES: .c .rel .y SRCSNS = expr.c test.c @@ -40,10 +40,8 @@ $(OBJSBAD): %.rel: %.c $(FCC) $(PLATFORM) -c $< expr.c: expr.y - byacc -o expr.c expr.y find.c: find.y - byacc -o find.c find.y .c.rel: $(FCC) $(PLATFORM) $(FCCOPTS) -c $< diff --git a/Kernel/Makefile b/Kernel/Makefile index aa867e54..d840b087 100644 --- a/Kernel/Makefile +++ b/Kernel/Makefile @@ -4,10 +4,6 @@ export VERSION = "0.1" export SUBVERSION = "ac1" export ROOT_DIR -ifeq ($(MAKE),) - export MAKE = "make" -endif - UNAME_S := $(shell uname -s) ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) @@ -169,6 +165,7 @@ font4x6.c: tools/make4x6 tools/make4x6 >font4x6.c clean: + rm -rf platform rm -f $(OBJS) $(JUNK) fuzix.cdb fuzix.com fuzix.tmp platform fuzix.bin fuzix.map fuzix.noi rm -f fuzix.ihx common.ihx common.bin relocs.dat core *~ include/*~ version.c tools/make4x6 rm -f tools/analysemap tools/memhogs tools/binman tools/bihx tools/binmunge tools/bintomdv diff --git a/Kernel/cpu-z80/image.mk b/Kernel/cpu-z80/image.mk index 73cdd732..774fee82 100644 --- a/Kernel/cpu-z80/image.mk +++ b/Kernel/cpu-z80/image.mk @@ -18,10 +18,10 @@ tools/bin2z80: tools/bin2z80.c tools/flat2z80: tools/flat2z80.c tools/bankld/sdldz80: - +(cd tools/bankld; make) + +(cd tools/bankld; $(MAKE)) cpm-loader/cpmload.bin: cpm-loader/cpmload.s cpm-loader/fuzixload.s cpm-loader/makecpmloader.c - +make -C cpm-loader + +$(MAKE) -C cpm-loader tools/makejv3: tools/makejv3.c @@ -34,5 +34,5 @@ fuzix.bin: fuzix.ihx tools/bihx tools/analysemap tools/memhogs tools/binman tool head -5 hogs.txt tools/bihx fuzix.ihx tools/binprep - +make -C platform-$(TARGET) image + +$(MAKE) -C platform-$(TARGET) image diff --git a/Kernel/platform-msx2/image.mk b/Kernel/platform-msx2/image.mk index 39153ebe..97bb7d64 100644 --- a/Kernel/platform-msx2/image.mk +++ b/Kernel/platform-msx2/image.mk @@ -11,4 +11,4 @@ fuzix.bin: fuzix.ihx tools/bihx tools/analysemap tools/memhogs tools/binman tool tools/binman common.bin fuzix.map fuzix.bin tools/bihx fuzix_boot.ihx -cp common.bin fuzix_boot.bin - +make -C platform-$(TARGET) image + +$(MAKE) -C platform-$(TARGET) image diff --git a/Kernel/tools/findsdcc b/Kernel/tools/findsdcc index 1efea0f2..44b5d4c2 100755 --- a/Kernel/tools/findsdcc +++ b/Kernel/tools/findsdcc @@ -1,2 +1,2 @@ #!/bin/sh -echo $(which sdcc | sed -e "s/bin\/sdcc//")share/sdcc/lib/$1 \ No newline at end of file +echo $(which sdcc | sed -e "s/bin\/sdcc//")share/sdcc/sdcc/lib/$1 diff --git a/Library/libs/Makefile.z80 b/Library/libs/Makefile.z80 index dfc78e43..99788e14 100644 --- a/Library/libs/Makefile.z80 +++ b/Library/libs/Makefile.z80 @@ -2,7 +2,6 @@ CC = fcc ASM = sdasz80 AR = sdar LINKER = sdldz80 -export MAKE = make # This gets set for 'awkward' devices like ZX128 #PLATFORM = -zx128 PLATFORM = -- 2.34.1