# # this makefile subsumes all the work done in Build.cmd, BuildDisk.cmd, BuildDisk.ps1 # SYSTEMS = ../CPM22/cpm_wbw.sys ../ZSDOS/zsys_wbw.sys ../QPM/qpm_wbw.sys ../CPM3/cpmldr.sys ../ZPM3/zpmldr.sys # OBJECTS = HD512PREFIX = HD1KPREFIX = hd1k_prefix.dat # add base images used in *.def files FDIMGS = $(wildcard fd_*.txt) FDIMGS := $(subst fd_,,$(FDIMGS)) FDIMGS := $(addprefix fd144_,$(FDIMGS)) FDIMGS := $(FDIMGS:.txt=.img) # $(info FDIMGS: $(FDIMGS)) HDIMGS = $(wildcard hd_*.txt) HDIMGS := $(subst hd_,,$(HDIMGS)) HDIMGS := $(addprefix hd512_,$(HDIMGS)) $(addprefix hd1k_,$(HDIMGS)) HDIMGS := $(HDIMGS:.txt=.img) # $(info HDIMGS: $(HDIMGS)) BASEIMGS = $(shell grep -vEh "^\#" *.def) BASEIMGS := $(addprefix hd512_,$(BASEIMGS)) $(addprefix hd1k_,$(BASEIMGS)) BASEIMGS := $(addsuffix .img,$(BASEIMGS)) # $(info BASEIMGS: $(BASEIMGS)) DSKIMGS = $(wildcard *.def) DSKIMGS := $(addprefix hd512_,$(DSKIMGS)) $(addprefix hd1k_,$(DSKIMGS)) DSKIMGS := $(DSKIMGS:.def=.img) # $(info DSKIMGS: $(DSKIMGS)) OBJECTS = $(FDIMGS) $(HDIMGS) $(BASEIMGS) $(DSKIMGS) $(HD512PREFIX) $(HD1KPREFIX) OTHERS = blank144 blankhd512 blankhd1k *.cat NODELETE = $(HD512PREFIX) $(HD1KPREFIX) DEST=../../Binary TOOLS = ../../Tools # $(info OBJECTS: $(OBJECTS)) include $(TOOLS)/Makefile.inc .SHELLFLAGS = -ce DIFFPATH = $(DIFFTO)/Binary hd512_%.img: %.def @echo "Generating hd512 disk image ""$@"" using $^"; \ files=`grep -vEh "^\s*\#" $^ | grep -vEh "^\s*$$" | tr -d '\r' | awk '{print "hd512_" $$0 ".img"}'`; \ echo " " $${files}; \ cat $(HD512PREFIX) $${files} > $@ hd1k_%.img: %.def @echo "Generating hd1k disk image ""$@"" using $^"; \ files=`grep -vEh "^\s*\#" $^ | grep -vEh "^\s*$$" | tr -d '\r' | awk '{print "hd1k_" $$0 ".img"}'`; \ echo " " $${files}; \ cat $(HD1KPREFIX) $${files} > $@ # # this somewhat impenetrable and fragile code is used to build each of the images # at build time, a few variables are set (sys, fmt, type, size, d) based on the # target to build. first, we build an empty image using the a tr, dd pipeline. # we then scan the d_{d}/u* directories, copying in files to user numbers # then process the ?d_{d}.txt file, copying in those files, and finally maybe put # an OS at the start of each image # FDSIZE := 1440 blank144: @echo Making Blank Floppy of size $(FDSIZE)k @LC_ALL=en_US.US-ASCII tr '\000' '\345' $(@:.img=.cat) clean:: @rm -f *.ls imgdiff: @for i in $(FDIMGS) $(HD512IMGS) $(HD512XIMGS) $(HD1KIMGS) $(HD1KXIMGS) ; do \ echo $$i ; \ if echo $$i | grep -q ^fd144_ ; then \ fmt=wbw_fd144 ; \ fi ; \ if echo $$i | grep -q ^hd512_ ; then \ fmt=wbw_hd512 ; \ fi ; \ if echo $$i | grep -q ^hd1k_ ; then \ fmt=wbw_hd1k ; \ fi ; \ $(BINDIR)/cpmls -i -f $$fmt $$i > $$i.ls ; \ $(BINDIR)/cpmls -i -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \ done \