Make the Makefiles more portable
authorRoberto E. Vargas Caballero <k0ga@shike2.com>
Sun, 11 Feb 2018 22:07:53 +0000 (22:07 +0000)
committerRoberto E. Vargas Caballero <k0ga@shike2.com>
Mon, 26 Feb 2018 18:59:08 +0000 (18:59 +0000)
- 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
Applications/MWC/cmd/Makefile.68000
Applications/MWC/cmd/Makefile.6809
Applications/MWC/cmd/Makefile.z80
Kernel/Makefile
Kernel/cpu-z80/image.mk
Kernel/platform-msx2/image.mk
Kernel/tools/findsdcc
Library/libs/Makefile.z80

index 97264fc..c134e27 100644 (file)
@@ -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
index 7927538..c1fe0c3 100644 (file)
@@ -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 $^ > $@
index 6f7169a..47f25c3 100644 (file)
@@ -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 $^ > $@
index 03a412c..206cf4d 100644 (file)
@@ -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 $<
index aa867e5..d840b08 100644 (file)
@@ -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
index 73cdd73..774fee8 100644 (file)
@@ -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
 
index 39153eb..97bb7d6 100644 (file)
@@ -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
index 1efea0f..44b5d4c 100755 (executable)
@@ -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
index dfc78e4..99788e1 100644 (file)
@@ -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 =