Browse Source

Make and Build Refactoring

patch
Wayne Warthen 5 years ago
parent
commit
1a78927854
  1. 6
      Build.cmd
  2. 5
      Clean.cmd
  3. 19
      Source/Apps/I2C/Makefile
  4. 2
      Source/Apps/Makefile
  5. 2
      Source/Apps/ramtest/Makefile
  6. 71
      Source/HBIOS/Build.cmd
  7. 2
      Source/Images/Makefile
  8. 6
      Source/RomDsk/Build.cmd
  9. 46
      Tools/Makefile.inc
  10. 7
      Tools/unix/Makefile
  11. 4
      Tools/unix/bin2asm/Makefile
  12. 2
      Tools/unix/bst/Makefile
  13. 4
      Tools/unix/lzsa/Makefile
  14. 2
      Tools/unix/uz80as/Makefile
  15. 2
      Tools/unix/zx/Makefile

6
Build.cmd

@ -0,0 +1,6 @@
@echo off
setlocal
pushd Source && call Build %* || exit /b & popd
pause

5
Clean.cmd

@ -0,0 +1,5 @@
@echo off
setlocal
pushd Binary && call Clean || exit /b 1 & popd
pushd Source && call Clean || exit /b 1 & popd

19
Source/Apps/I2C/Makefile

@ -2,20 +2,7 @@ OBJECTS = i2cscan.com rtcds7.com i2clcd.com
DEST = ../../../Binary/Apps DEST = ../../../Binary/Apps
TOOLS = ../../../Tools TOOLS = ../../../Tools
include $(TOOLS)/Makefile.inc
DEPS1 := i2cscan.asm $(shell find . -name '*.inc')
DEPS2 := rtcds7.asm $(shell find . -name '*.inc')
DEPS3 := i2clcd.asm $(shell find . -name '*.inc')
i2cscan.com: $(DEPS1)
$(TASM) -dWBW i2cscan.asm i2cscan.com i2cscan.lst
rtcds7.com: $(DEPS2)
$(TASM) -dWBW rtcds7.asm rtcds7.com rtcds7.lst
i2clcd.com: $(DEPS3)
$(TASM) -dWBW i2clcd.asm i2clcd.com i2clcd.lst
USETASM=1
TASMFLAGS=-dWBW
include $(TOOLS)/Makefile.inc

2
Source/Apps/Makefile

@ -10,5 +10,5 @@ include $(TOOLS)/Makefile.inc
USETASM = 1 USETASM = 1
survey.com: USETASM=0
survey.com: USETASM = 0

2
Source/Apps/ramtest/Makefile

@ -6,5 +6,5 @@ OTHERS = loader.bin dbgmon.bin
include $(TOOLS)/Makefile.inc include $(TOOLS)/Makefile.inc
ramtest.com: loader.bin dbgmon.bin ramtest.com: loader.bin dbgmon.bin
cat loader.bin dbgmon.bin >ramtest.com
cat $^ >$@

71
Source/HBIOS/Build.cmd

@ -15,19 +15,46 @@ set ZXBINDIR=%TOOLS%/cpm/bin/
set ZXLIBDIR=%TOOLS%/cpm/lib/ set ZXLIBDIR=%TOOLS%/cpm/lib/
set ZXINCDIR=%TOOLS%/cpm/include/ set ZXINCDIR=%TOOLS%/cpm/include/
::
:: This PowerShell script validates the build variables passed in. If
:: necessary, the user is prmopted to pick the variables. It then creates
:: an include file that is imbedded in the HBIOS assembly (build.inc).
:: It also creates a batch command file that sets environment variables
:: for use by the remainder of this batch file (build_env.cmd).
::
PowerShell -ExecutionPolicy Unrestricted .\Build.ps1 %* || exit /b PowerShell -ExecutionPolicy Unrestricted .\Build.ps1 %* || exit /b
::
:: Below, we process the command file created by the PowerShell script.
:: This sets the environment variables: Platform, Config, ROMName,
:: ROMSize, & CPUType.
::
call build_env.cmd call build_env.cmd
::
:: Start of the actual build process for a given ROM.
::
echo Building %ROMSize%K ROM %ROMName% for Z%CPUType% CPU... echo Building %ROMSize%K ROM %ROMName% for Z%CPUType% CPU...
::
:: UNA is a special case, check for it and jump if needed.
::
if %Platform%==UNA goto :UNA if %Platform%==UNA goto :UNA
::
:: Bring the previously build font files into this directory
::
copy ..\Fonts\font*.asm . || exit /b copy ..\Fonts\font*.asm . || exit /b
:: ::
:: Build HBIOS Core (all variants) :: Build HBIOS Core (all variants)
:: ::
tasm -t%CPUType% -g3 -dROMBOOT hbios.asm hbios_rom.bin hbios_rom.lst || exit /b tasm -t%CPUType% -g3 -dROMBOOT hbios.asm hbios_rom.bin hbios_rom.lst || exit /b
tasm -t%CPUType% -g3 -dAPPBOOT hbios.asm hbios_app.bin hbios_app.lst || exit /b tasm -t%CPUType% -g3 -dAPPBOOT hbios.asm hbios_app.bin hbios_app.lst || exit /b
tasm -t%CPUType% -g3 -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst || exit /b tasm -t%CPUType% -g3 -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst || exit /b
@ -35,6 +62,7 @@ tasm -t%CPUType% -g3 -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst || exit /b
:: ::
:: Build ROM Components :: Build ROM Components
:: ::
call :asm dbgmon call :asm dbgmon
call :asm romldr call :asm romldr
call :asm eastaegg call :asm eastaegg
@ -46,27 +74,40 @@ call :asm updater
call :asm imgpad2 call :asm imgpad2
:: ::
:: Create ROM bank images by assembling components
:: Create additional ROM bank images by assembling components into
:: 32K chunks which can be concatenated later. Note that
:: osimg_small is a special case because it is 20K in size. This
:: image is subsequently used to generate the .com loadable file.
:: ::
copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin + ..\cpm22\cpm_wbw.bin osimg.bin || exit /b copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin + ..\cpm22\cpm_wbw.bin osimg.bin || exit /b
copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin osimg_small.bin || exit /b
copy /b ..\Forth\camel80.bin + nascom.bin + tastybasic.bin + game.bin + eastaegg.bin + netboot.mod + updater.bin + usrrom.bin osimg1.bin || exit /b copy /b ..\Forth\camel80.bin + nascom.bin + tastybasic.bin + game.bin + eastaegg.bin + netboot.mod + updater.bin + usrrom.bin osimg1.bin || exit /b
copy /b imgpad2.bin osimg2.bin || exit /b copy /b imgpad2.bin osimg2.bin || exit /b
copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin osimg_small.bin || exit /b
:: ::
:: Create final ROM images
:: Create final images (.rom, .upd, & .com)
:: The previously created bank images are concatenated as needed.
::
:: The .rom image is made up of 4 banks followed by the ROM Disk. This
:: is for programming onto a ROM.
::
:: The .upd image is the same as above, but without the the ROM Disk.
:: This is so you can update just the code portion of your ROM without
:: updating the ROM Disk contents.
::
:: The .com image is a scaled down version of the ROM that you can run
:: as a standard application under an OS and it will replace your
:: HBIOS on the fly for testing purposes.
:: ::
set RomDiskDat=
if %ROMSize% GTR 128 set RomDiskDat=..\RomDsk\rom%ROMSize%_wbw.dat
copy /b hbios_rom.bin + osimg.bin + osimg1.bin + osimg2.bin + ..\RomDsk\rom%ROMSize%_wbw.dat %ROMName%.rom || exit /b copy /b hbios_rom.bin + osimg.bin + osimg1.bin + osimg2.bin + ..\RomDsk\rom%ROMSize%_wbw.dat %ROMName%.rom || exit /b
copy /b hbios_rom.bin + osimg.bin + osimg1.bin + osimg2.bin %ROMName%.upd || exit /b copy /b hbios_rom.bin + osimg.bin + osimg1.bin + osimg2.bin %ROMName%.upd || exit /b
copy /b hbios_app.bin + osimg_small.bin %ROMName%.com || exit /b copy /b hbios_app.bin + osimg_small.bin %ROMName%.com || exit /b
:: ::
:: Copy to output directory
:: Copy results to output directory
:: ::
copy %ROMName%.rom ..\..\Binary || exit /b copy %ROMName%.rom ..\..\Binary || exit /b
@ -81,23 +122,39 @@ goto :eof
:UNA :UNA
::
:: This process is basically equivalent to the one above, but tailored
:: for the UNA BIOS.
::
:: Build ROM components required by UNA
call :asm dbgmon call :asm dbgmon
call :asm romldr call :asm romldr
:: Create the OS bank
copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_una.bin + ..\cpm22\cpm_una.bin osimg.bin || exit /b copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_una.bin + ..\cpm22\cpm_una.bin osimg.bin || exit /b
:: Copy OS Bank and ROM Disk image files to output
copy /b osimg.bin ..\..\Binary\UNA_WBW_SYS.bin || exit /b copy /b osimg.bin ..\..\Binary\UNA_WBW_SYS.bin || exit /b
copy /b ..\RomDsk\rom%ROMSize%_una.dat ..\..\Binary\UNA_WBW_ROM%ROMSize%.bin || exit /b copy /b ..\RomDsk\rom%ROMSize%_una.dat ..\..\Binary\UNA_WBW_ROM%ROMSize%.bin || exit /b
:: Create the final ROM image
copy /b ..\UBIOS\UNA-BIOS.BIN + osimg.bin + ..\UBIOS\FSFAT.BIN + ..\RomDsk\rom%ROMSize%_una.dat %ROMName%.rom || exit /b copy /b ..\UBIOS\UNA-BIOS.BIN + osimg.bin + ..\UBIOS\FSFAT.BIN + ..\RomDsk\rom%ROMSize%_una.dat %ROMName%.rom || exit /b
:: Copy to output
copy %ROMName%.rom ..\..\Binary || exit /b copy %ROMName%.rom ..\..\Binary || exit /b
goto :eof goto :eof
::
:: Simple procedure to assemble a specified component via TASM.
::
:asm :asm
echo. echo.
echo Building %1... echo Building %1...
tasm -t80 -g3 -fFF %1.asm %1.bin %1.lst || exit /b tasm -t80 -g3 -fFF %1.asm %1.bin %1.lst || exit /b
goto :eof goto :eof

2
Source/Images/Makefile

@ -28,6 +28,8 @@ DEST=../../Binary
TOOLS = ../../Tools TOOLS = ../../Tools
include $(TOOLS)/Makefile.inc include $(TOOLS)/Makefile.inc
.SHELLFLAGS = -ce
DIFFPATH = $(DIFFTO)/Binary DIFFPATH = $(DIFFTO)/Binary
hd512_combo.img: $(HD512PREFIX) $(HD512IMGS) hd512_combo.img: $(HD512PREFIX) $(HD512IMGS)

6
Source/RomDsk/Build.cmd

@ -21,6 +21,9 @@ set ZXINCDIR=%TOOLS%/cpm/include/
:: the final ROM size less 128K. :: the final ROM size less 128K.
:: ::
copy NUL rom128_wbw.dat
copy NUL rom128_una.dat
:: MakeDisk <OutputFile> <ImageSize> <Format> <Directory> <Bios> :: MakeDisk <OutputFile> <ImageSize> <Format> <Directory> <Bios>
set RomApps=assign mode rtc syscopy xm set RomApps=assign mode rtc syscopy xm
@ -47,13 +50,16 @@ set Bios=%5
echo Making ROM Disk %Output% echo Making ROM Disk %Output%
:: Create the empty disk image file
srec_cat -Generate 0 %Size% --Constant 0xE5 -Output %Output%.dat -Binary || exit /b srec_cat -Generate 0 %Size% --Constant 0xE5 -Output %Output%.dat -Binary || exit /b
:: Populate the disk image via cpmtools
cpmcp -f %Format% %Output%.dat %Content%/*.* 0: || exit /b cpmcp -f %Format% %Output%.dat %Content%/*.* 0: || exit /b
for %%f in (%RomApps%) do cpmcp -f %Format% %Output%.dat ../../Binary/Apps/%%f.com 0: || exit /b for %%f in (%RomApps%) do cpmcp -f %Format% %Output%.dat ../../Binary/Apps/%%f.com 0: || exit /b
cpmcp -f %Format% %Output%.dat ..\cpm22\cpm_%Bios%.sys 0:cpm.sys || exit /b cpmcp -f %Format% %Output%.dat ..\cpm22\cpm_%Bios%.sys 0:cpm.sys || exit /b
cpmcp -f %Format% %Output%.dat ..\zsdos\zsys_%Bios%.sys 0:zsys.sys || exit /b cpmcp -f %Format% %Output%.dat ..\zsdos\zsys_%Bios%.sys 0:zsys.sys || exit /b
:: Mark all disk files R/O for safety
cpmchattr -f %Format% %Output%.dat r 0:*.* || exit /b cpmchattr -f %Format% %Output%.dat r 0:*.* || exit /b
goto :eof goto :eof

46
Tools/Makefile.inc

@ -34,8 +34,12 @@ DIFFPATH := $(DIFFTO)/$(RELPATH)
# #
CASEFN = $(TOOLS)/unix/casefn.sh CASEFN = $(TOOLS)/unix/casefn.sh
#
# compiler/assembler locations and flags
#
ZXCC=$(BINDIR)/zx ZXCC=$(BINDIR)/zx
TASM=$(BINDIR)/uz80as -t z80 TASM=$(BINDIR)/uz80as -t z80
TASMFLAGS=
OPENSPIN=$(BINDIR)/openspin OPENSPIN=$(BINDIR)/openspin
BSTC=$(BINDIR)//bstc BSTC=$(BINDIR)//bstc
CPMCP=$(BINDIR)/cpmcp CPMCP=$(BINDIR)/cpmcp
@ -45,32 +49,42 @@ CPMCP=$(BINDIR)/cpmcp
# #
CPM=$(TOOLS)/cpm/bin CPM=$(TOOLS)/cpm/bin
#
# .ONESHELL uses a single shell instance for all shell scripts.
# .SHELLFLAGS is used to cause all shell scripts to echo ("e") and to
# exit if any command returns a non-zero result ("x").
#
.ONESHELL:
.SHELLFLAGS = -cex
%.com: %.asm %.com: %.asm
if [ "$(USETASM)" = 1 ] ; then \
$(TASM) $< $@ ; \
@if [ "$(USETASM)" = 1 ] ; then \
$(TASM) $(TASMFLAGS) $< $@ $*.lst ; \
else \ else \
$(ZXCC) $(CPM)/MAC -$< -$$PO ; \ $(ZXCC) $(CPM)/MAC -$< -$$PO ; \
$(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex ; \ $(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex ; \
mv tmp.bin $@ ; \ mv tmp.bin $@ ; \
rm -f /tmp/casefn.cache ; \
rm -f $$($(CASEFN) $*.hex) ; \ rm -f $$($(CASEFN) $*.hex) ; \
fi fi
%.hex: %.asm %.hex: %.asm
$(ZXCC) $(CPM)/MAC -$< -$$PO ; \
$(ZXCC) $(CPM)/MAC -$< -$$PO
%.bin: %.ASM %.bin: %.ASM
$(ZXCC) $(CPM)/MAC -$< -$$PO $(ZXCC) $(CPM)/MAC -$< -$$PO
$(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex $(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex
mv tmp.bin $@ mv tmp.bin $@
rm -f /tmp/casefn.cache
rm -f $$($(CASEFN) $*.hex) rm -f $$($(CASEFN) $*.hex)
%.com: %.z80 %.com: %.z80
$(ZXCC) $(CPM)/Z80ASM -$(basename $<)/F ; \
rm -f /tmp/casefn.cache ; \
$(ZXCC) $(CPM)/Z80ASM -$(basename $<)/F
rm -f /tmp/casefn.cache
mv $$($(CASEFN) $@) tmp.com ; mv tmp.com $@ mv $$($(CASEFN) $@) tmp.com ; mv tmp.com $@
%.bin: %.asm %.bin: %.asm
$(TASM) $< $@
$(TASM) $(TASMFLAGS) $< $@ $*.lst
%.rel: %.asm %.rel: %.asm
$(ZXCC) $(CPM)/RMAC -$< $(ZXCC) $(CPM)/RMAC -$<
@ -95,8 +109,6 @@ ifeq ($(UNAME), Linux)
$(BSTC) -e -l $< $(BSTC) -e -l $<
endif endif
.ONESHELL:
# #
# darwin bstc won't run, since mac os does not do 32 bit binaries any more # darwin bstc won't run, since mac os does not do 32 bit binaries any more
# openspin ought to work # openspin ought to work
@ -110,29 +122,36 @@ endif
# first target is default # first target is default
# #
all:: $(OBJECTS) all:: $(OBJECTS)
@$(foreach subdir,$(SUBDIRS),echo "*** Making directory $(subdir)"; $(MAKE) --directory $(subdir) all || exit 1;)
@for dir in $(SUBDIRS) ; do \
$(MAKE) --directory $$dir all ; \
done
@if [ "$(DEST)" ] ; then for file in $(filter-out $(NOCOPY),$(OBJECTS)) ; do \ @if [ "$(DEST)" ] ; then for file in $(filter-out $(NOCOPY),$(OBJECTS)) ; do \
mkdir -p $(DEST) ; \ mkdir -p $(DEST) ; \
echo copy $$file to $(DEST) ; \
echo Copying $$file to $(DEST) ; \
rm -f /tmp/casefn.cache ; \ rm -f /tmp/casefn.cache ; \
cp $$($(CASEFN) $$file) $(DEST) ; \ cp $$($(CASEFN) $$file) $(DEST) ; \
done ; fi done ; fi
@if [ "$(DOCDEST)" ] ; then for file in $(DOCS) ; do \ @if [ "$(DOCDEST)" ] ; then for file in $(DOCS) ; do \
mkdir -p $(DOCDEST) ; \ mkdir -p $(DOCDEST) ; \
echo copy $$file to $(DOCDEST) ; \
echo Copying $$file to $(DOCDEST) ; \
rm -f /tmp/casefn.cache ; \
cp $$($(CASEFN) $$file) $(DOCDEST) ; \ cp $$($(CASEFN) $$file) $(DOCDEST) ; \
done ; fi done ; fi
clean:: clean::
@-rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS))) @-rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS)))
@$(foreach subdir,$(SUBDIRS),echo "*** Cleaning directory $(subdir)"; $(MAKE) --directory $(subdir) clean || exit 1;)
@for dir in $(SUBDIRS) ; do \
$(MAKE) --directory $$dir clean ; \
done
clobber:: clean clobber:: clean
@if [ "$(DEST)" ] ; then for file in $(OBJECTS) ; do \ @if [ "$(DEST)" ] ; then for file in $(OBJECTS) ; do \
rm -f $$($(CASEFN) $(DEST)/$$file) ; \ rm -f $$($(CASEFN) $(DEST)/$$file) ; \
done ; fi done ; fi
@-rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS))) @-rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS)))
@$(foreach subdir,$(SUBDIRS),echo "*** Clobbering directory $(subdir)"; $(MAKE) --directory $(subdir) clobber || exit 1;)
@for dir in $(SUBDIRS) ; do \
$(MAKE) --directory $$dir clobber ; \
done
# #
# this is used to verify that the unix and windows tool chains are generating # this is used to verify that the unix and windows tool chains are generating
# the same objects # the same objects
@ -165,4 +184,3 @@ endif
vdiff: vdiff:
make VERBOSEDIFF=2 diff make VERBOSEDIFF=2 diff

7
Tools/unix/Makefile

@ -13,10 +13,11 @@ SUBDIRS = bst uz80as zx cpmtools bin2asm lzsa
all: all:
@chmod +x casefn.sh @chmod +x casefn.sh
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) all || exit 1;)
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) all;)
clobber: clobber:
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clobber || exit 1;)
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clobber;)
@rm -rf ../$(UNAME)
clean: clean:
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clean || exit 1;)
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clean;)

4
Tools/unix/bin2asm/Makefile

@ -16,9 +16,9 @@ $(DEST):
.PHONY: clean .PHONY: clean
clean: clean:
rm -f $(OBJ_FILES)
rm -f $(OBJ_FILES) $(BINARY)
clobber:
clobber: clean
rm -f $(DEST)/$(BINARY) $(BINARY) rm -f $(DEST)/$(BINARY) $(BINARY)
$(BINARY): $(OBJ_FILES) $(BINARY): $(OBJ_FILES)

2
Tools/unix/bst/Makefile

@ -20,7 +20,7 @@ all: $(DEST)
$(DEST): $(DEST):
mkdir $(DEST) mkdir $(DEST)
clobber:
clobber: clean
-for i in *.$(SUFFIX) ; do \ -for i in *.$(SUFFIX) ; do \
rm $(DEST)/$$(basename $$i .$(SUFFIX)) ; \ rm $(DEST)/$$(basename $$i .$(SUFFIX)) ; \
done done

4
Tools/unix/lzsa/Makefile

@ -36,11 +36,11 @@ all: $(APP)
cp -p $(APP) ../../$(UNAME) cp -p $(APP) ../../$(UNAME)
$(APP): $(OBJS) $(APP): $(OBJS)
@mkdir -p ../../bin/posix
#@mkdir -p ../../bin/posix
$(CC) $^ $(LDFLAGS) -o $(APP) $(CC) $^ $(LDFLAGS) -o $(APP)
clean: clean:
@rm -rf $(APP) $(OBJDIR) @rm -rf $(APP) $(OBJDIR)
clobber:
clobber: clean
rm -f ../../$(UNAME)/$(APP) rm -f ../../$(UNAME)/$(APP)

2
Tools/unix/uz80as/Makefile

@ -53,7 +53,7 @@ clobber: clean
-rm -f uz80as $(DEST)/uz80as -rm -f uz80as $(DEST)/uz80as
clean: clean:
-rm -f $(OBJECTS)
-rm -f $(OBJECTS) uz80as
uz80as: $(OBJECTS) uz80as: $(OBJECTS)
$(CC) $(CFLAGS) -o uz80as $(OBJECTS) $(CC) $(CFLAGS) -o uz80as $(OBJECTS)

2
Tools/unix/zx/Makefile

@ -23,7 +23,7 @@ $(DEST):
mkdir -p $(DEST) mkdir -p $(DEST)
clean: clean:
-rm -f $(OBJECTS) config.h
-rm -f $(OBJECTS) config.h zx
clobber: clean clobber: clean
-rm -f $(DEST)/zx $(DEST)/bios.bin zx -rm -f $(DEST)/zx $(DEST)/bios.bin zx

Loading…
Cancel
Save