Make and Build Refactoring
This commit is contained in:
6
Build.cmd
Normal file
6
Build.cmd
Normal file
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
pushd Source && call Build %* || exit /b & popd
|
||||
|
||||
pause
|
||||
5
Clean.cmd
Normal file
5
Clean.cmd
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
pushd Binary && call Clean || exit /b 1 & popd
|
||||
pushd Source && call Clean || exit /b 1 & popd
|
||||
@@ -2,20 +2,7 @@ OBJECTS = i2cscan.com rtcds7.com i2clcd.com
|
||||
DEST = ../../../Binary/Apps
|
||||
TOOLS = ../../../Tools
|
||||
|
||||
USETASM=1
|
||||
TASMFLAGS=-dWBW
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ OTHERS = loader.bin dbgmon.bin
|
||||
include $(TOOLS)/Makefile.inc
|
||||
|
||||
ramtest.com: loader.bin dbgmon.bin
|
||||
cat loader.bin dbgmon.bin >ramtest.com
|
||||
cat $^ >$@
|
||||
|
||||
|
||||
@@ -15,19 +15,46 @@ set ZXBINDIR=%TOOLS%/cpm/bin/
|
||||
set ZXLIBDIR=%TOOLS%/cpm/lib/
|
||||
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
|
||||
|
||||
::
|
||||
:: 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
|
||||
|
||||
::
|
||||
:: Start of the actual build process for a given ROM.
|
||||
::
|
||||
|
||||
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
|
||||
|
||||
::
|
||||
:: Bring the previously build font files into this directory
|
||||
::
|
||||
|
||||
copy ..\Fonts\font*.asm . || exit /b
|
||||
|
||||
::
|
||||
:: Build HBIOS Core (all variants)
|
||||
::
|
||||
|
||||
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 -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
|
||||
::
|
||||
|
||||
call :asm dbgmon
|
||||
call :asm romldr
|
||||
call :asm eastaegg
|
||||
@@ -46,27 +74,40 @@ call :asm updater
|
||||
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 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 imgpad2.bin osimg2.bin || exit /b
|
||||
|
||||
::
|
||||
:: Create final ROM images
|
||||
::
|
||||
copy /b romldr.bin + dbgmon.bin + ..\zsdos\zsys_wbw.bin osimg_small.bin || exit /b
|
||||
|
||||
set RomDiskDat=
|
||||
if %ROMSize% GTR 128 set RomDiskDat=..\RomDsk\rom%ROMSize%_wbw.dat
|
||||
::
|
||||
:: 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.
|
||||
::
|
||||
|
||||
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_app.bin + osimg_small.bin %ROMName%.com || exit /b
|
||||
|
||||
::
|
||||
:: Copy to output directory
|
||||
:: Copy results to output directory
|
||||
::
|
||||
|
||||
copy %ROMName%.rom ..\..\Binary || exit /b
|
||||
@@ -81,23 +122,39 @@ goto :eof
|
||||
|
||||
: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 romldr
|
||||
|
||||
:: Create the OS bank
|
||||
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 ..\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 to output
|
||||
copy %ROMName%.rom ..\..\Binary || exit /b
|
||||
|
||||
goto :eof
|
||||
|
||||
::
|
||||
:: Simple procedure to assemble a specified component via TASM.
|
||||
::
|
||||
|
||||
:asm
|
||||
|
||||
echo.
|
||||
echo Building %1...
|
||||
tasm -t80 -g3 -fFF %1.asm %1.bin %1.lst || exit /b
|
||||
|
||||
goto :eof
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ DEST=../../Binary
|
||||
TOOLS = ../../Tools
|
||||
include $(TOOLS)/Makefile.inc
|
||||
|
||||
.SHELLFLAGS = -ce
|
||||
|
||||
DIFFPATH = $(DIFFTO)/Binary
|
||||
|
||||
hd512_combo.img: $(HD512PREFIX) $(HD512IMGS)
|
||||
|
||||
@@ -21,6 +21,9 @@ set ZXINCDIR=%TOOLS%/cpm/include/
|
||||
:: the final ROM size less 128K.
|
||||
::
|
||||
|
||||
copy NUL rom128_wbw.dat
|
||||
copy NUL rom128_una.dat
|
||||
|
||||
:: MakeDisk <OutputFile> <ImageSize> <Format> <Directory> <Bios>
|
||||
|
||||
set RomApps=assign mode rtc syscopy xm
|
||||
@@ -47,13 +50,16 @@ set Bios=%5
|
||||
|
||||
echo Making ROM Disk %Output%
|
||||
|
||||
:: Create the empty disk image file
|
||||
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
|
||||
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 ..\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
|
||||
|
||||
goto :eof
|
||||
|
||||
@@ -34,8 +34,12 @@ DIFFPATH := $(DIFFTO)/$(RELPATH)
|
||||
#
|
||||
CASEFN = $(TOOLS)/unix/casefn.sh
|
||||
|
||||
#
|
||||
# compiler/assembler locations and flags
|
||||
#
|
||||
ZXCC=$(BINDIR)/zx
|
||||
TASM=$(BINDIR)/uz80as -t z80
|
||||
TASMFLAGS=
|
||||
OPENSPIN=$(BINDIR)/openspin
|
||||
BSTC=$(BINDIR)//bstc
|
||||
CPMCP=$(BINDIR)/cpmcp
|
||||
@@ -45,32 +49,42 @@ CPMCP=$(BINDIR)/cpmcp
|
||||
#
|
||||
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
|
||||
if [ "$(USETASM)" = 1 ] ; then \
|
||||
$(TASM) $< $@ ; \
|
||||
@if [ "$(USETASM)" = 1 ] ; then \
|
||||
$(TASM) $(TASMFLAGS) $< $@ $*.lst ; \
|
||||
else \
|
||||
$(ZXCC) $(CPM)/MAC -$< -$$PO ; \
|
||||
$(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex ; \
|
||||
mv tmp.bin $@ ; \
|
||||
rm -f /tmp/casefn.cache ; \
|
||||
rm -f $$($(CASEFN) $*.hex) ; \
|
||||
fi
|
||||
|
||||
%.hex: %.asm
|
||||
$(ZXCC) $(CPM)/MAC -$< -$$PO ; \
|
||||
$(ZXCC) $(CPM)/MAC -$< -$$PO
|
||||
|
||||
%.bin: %.ASM
|
||||
$(ZXCC) $(CPM)/MAC -$< -$$PO
|
||||
$(ZXCC) $(CPM)/MLOAD25 -tmp.bin=$*.hex
|
||||
mv tmp.bin $@
|
||||
rm -f /tmp/casefn.cache
|
||||
rm -f $$($(CASEFN) $*.hex)
|
||||
|
||||
%.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 $@
|
||||
|
||||
%.bin: %.asm
|
||||
$(TASM) $< $@
|
||||
$(TASM) $(TASMFLAGS) $< $@ $*.lst
|
||||
|
||||
%.rel: %.asm
|
||||
$(ZXCC) $(CPM)/RMAC -$<
|
||||
@@ -95,8 +109,6 @@ ifeq ($(UNAME), Linux)
|
||||
$(BSTC) -e -l $<
|
||||
endif
|
||||
|
||||
.ONESHELL:
|
||||
|
||||
#
|
||||
# darwin bstc won't run, since mac os does not do 32 bit binaries any more
|
||||
# openspin ought to work
|
||||
@@ -110,29 +122,36 @@ endif
|
||||
# first target is default
|
||||
#
|
||||
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 \
|
||||
mkdir -p $(DEST) ; \
|
||||
echo copy $$file to $(DEST) ; \
|
||||
echo Copying $$file to $(DEST) ; \
|
||||
rm -f /tmp/casefn.cache ; \
|
||||
cp $$($(CASEFN) $$file) $(DEST) ; \
|
||||
done ; fi
|
||||
@if [ "$(DOCDEST)" ] ; then for file in $(DOCS) ; do \
|
||||
mkdir -p $(DOCDEST) ; \
|
||||
echo copy $$file to $(DOCDEST) ; \
|
||||
echo Copying $$file to $(DOCDEST) ; \
|
||||
rm -f /tmp/casefn.cache ; \
|
||||
cp $$($(CASEFN) $$file) $(DOCDEST) ; \
|
||||
done ; fi
|
||||
|
||||
clean::
|
||||
@-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
|
||||
@if [ "$(DEST)" ] ; then for file in $(OBJECTS) ; do \
|
||||
rm -f $$($(CASEFN) $(DEST)/$$file) ; \
|
||||
done ; fi
|
||||
@-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
|
||||
# the same objects
|
||||
@@ -165,4 +184,3 @@ endif
|
||||
|
||||
vdiff:
|
||||
make VERBOSEDIFF=2 diff
|
||||
|
||||
|
||||
@@ -13,10 +13,11 @@ SUBDIRS = bst uz80as zx cpmtools bin2asm lzsa
|
||||
|
||||
all:
|
||||
@chmod +x casefn.sh
|
||||
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) all || exit 1;)
|
||||
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) all;)
|
||||
|
||||
clobber:
|
||||
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clobber || exit 1;)
|
||||
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clobber;)
|
||||
@rm -rf ../$(UNAME)
|
||||
|
||||
clean:
|
||||
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clean || exit 1;)
|
||||
@$(foreach subdir,$(SUBDIRS),$(MAKE) --directory $(subdir) clean;)
|
||||
@@ -16,9 +16,9 @@ $(DEST):
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ_FILES)
|
||||
rm -f $(OBJ_FILES) $(BINARY)
|
||||
|
||||
clobber:
|
||||
clobber: clean
|
||||
rm -f $(DEST)/$(BINARY) $(BINARY)
|
||||
|
||||
$(BINARY): $(OBJ_FILES)
|
||||
|
||||
@@ -20,7 +20,7 @@ all: $(DEST)
|
||||
$(DEST):
|
||||
mkdir $(DEST)
|
||||
|
||||
clobber:
|
||||
clobber: clean
|
||||
-for i in *.$(SUFFIX) ; do \
|
||||
rm $(DEST)/$$(basename $$i .$(SUFFIX)) ; \
|
||||
done
|
||||
|
||||
@@ -36,11 +36,11 @@ all: $(APP)
|
||||
cp -p $(APP) ../../$(UNAME)
|
||||
|
||||
$(APP): $(OBJS)
|
||||
@mkdir -p ../../bin/posix
|
||||
#@mkdir -p ../../bin/posix
|
||||
$(CC) $^ $(LDFLAGS) -o $(APP)
|
||||
|
||||
clean:
|
||||
@rm -rf $(APP) $(OBJDIR)
|
||||
|
||||
clobber:
|
||||
clobber: clean
|
||||
rm -f ../../$(UNAME)/$(APP)
|
||||
|
||||
@@ -53,7 +53,7 @@ clobber: clean
|
||||
-rm -f uz80as $(DEST)/uz80as
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJECTS)
|
||||
-rm -f $(OBJECTS) uz80as
|
||||
|
||||
uz80as: $(OBJECTS)
|
||||
$(CC) $(CFLAGS) -o uz80as $(OBJECTS)
|
||||
|
||||
@@ -23,7 +23,7 @@ $(DEST):
|
||||
mkdir -p $(DEST)
|
||||
|
||||
clean:
|
||||
-rm -f $(OBJECTS) config.h
|
||||
-rm -f $(OBJECTS) config.h zx
|
||||
|
||||
clobber: clean
|
||||
-rm -f $(DEST)/zx $(DEST)/bios.bin zx
|
||||
|
||||
Reference in New Issue
Block a user