]> cloudbase.mooo.com Git - avrcpm.git/blobdiff - cpm/Makefile
SVN --> GIT
[avrcpm.git] / cpm / Makefile
index 19485f3b59d40dbda613a28b2bb9c6c7c02d2586..e60ea576df6c95d137a2bc40ac0de17d40b47c3e 100644 (file)
@@ -1,40 +1,82 @@
 #WARNING! Do not run a 'make install' unless you know what you're doing.
 
+CPMSIZE = 62
 
-diskimage: cpm.bin cpmdsk/*
-       mkfs.cpm -f avrcpm -b cpm.bin -L test diskimage
-       cd cpmdsk; for x in *; do cpmcp -f avrcpm ../diskimage $$x 0:$$x; done; cd ..
+CPMSYS = CPM$(CPMSIZE).SYS
 
-cpm.bin: ipl.bin bios.bin CPM.SYS
-       dd conv=sync bs=128  count=1 if=ipl.bin > cpm.bin
-       dd conv=sync bs=128 count=44 if=CPM.SYS >> cpm.bin
-       dd conv=sync bs=128  count=7 if=bios.bin >> cpm.bin
+IMGFORMAT = avrcpm
+#IMGFORMAT = simhd
 
+# CP/M emulator
+CPMEMU = aliados
 
-bios.prn bios.rel : avrcpm.lib cfgacpm.lib
-ipl.prn ipl.rel : cfgacpm.lib
 
-%.rel: %.mac
-       zxcc m80 -=$<
+ifeq "$(OS)" "Windows_NT"
+  PLATFORM=win32
+else
+  PLATFORM=Linux
+endif
+
+
+#Location of M80/L80
+ifeq ($(PLATFORM),Linux)
+  CPMBIN = /usr/local/lib/cpm/bin80
+else
+  CPMBIN = C:/cpmbin
+endif
+
+
+diskimage: CPM.BIN cpmdsk/*
+       mkfs.cpm -f $(IMGFORMAT) -b CPM.BIN -L test diskimage
+       cd cpmdsk; for x in *; do cpmcp -f $(IMGFORMAT) ../diskimage $$x 0:$$x; done; cd ..
 
+CPM.BIN: IPL.BIN BIOS.BIN $(CPMSYS)
+       dd conv=sync bs=118  count=1 if=IPL.BIN > tmpCPM.BIN   &&\
+       echo -n "<CPM_Disk>" >> tmpCPM.BIN                     &&\
+       dd conv=sync bs=128 count=44 if=$(CPMSYS) >> tmpCPM.BIN  &&\
+       dd conv=sync bs=128  count=7 if=BIOS.BIN >> tmpCPM.BIN &&\
+       mv tmpCPM.BIN CPM.BIN
 
-%.prn: %.mac
-       zxcc m80 -,$@=$<
+zsdossys: IPL.BIN CCP.BIN ZSDOS.BIN BIOS.BIN
+       dd conv=sync bs=118 count=1  if=IPL.BIN    > tmpCPM.BIN  &&\
+               echo -n "<CPM_Disk>"              >> tmpCPM.BIN  &&\
+       dd conv=sync bs=128 count=16 if=CCP.BIN   >> tmpCPM.BIN  &&\
+       dd conv=sync bs=128 count=28 if=ZSDOS.BIN >> tmpCPM.BIN  &&\
+       dd conv=sync bs=128 count=7  if=BIOS.BIN  >> tmpCPM.BIN  &&\
+       mv tmpCPM.BIN zsdossys
 
-%.bin: %.rel
-       zxcc l80 -$<,$@/N/E
+
+BIOS.PRN BIOS.REL : AVRCPM.LIB CFGACPM.LIB
+IPL.PRN IPL.REL : CFGACPM.LIB
+
+%.REL: %.MAC
+       $(CPMEMU) $(CPMBIN)/m80.com =$<
+#      zxcc m80 -=$<
+
+
+%.PRN: %.MAC
+       $(CPMEMU) $(CPMBIN)/m80.com ,$@=$<
+#      zxcc m80.com -,$@=$<
+
+%.BIN: %.REL
+       $(CPMEMU) $(CPMBIN)/l80.com $<,$@/N/E
+#      zxcc l80.com -$<,$@/N/E
+
+%.COM: %.REL
+       $(CPMEMU) $(CPMBIN)/l80.com $<,$@/N/E
+#      zxcc l80.com -$<,$@/N/E
 
 .PHONY: clean installcpm install help
 
 clean:
-       rm -f bios.lst bios.bin bios.prn bios.rel
-       rm -f ipl.lst ipl.bin ipl.prn ipl.rel
-       rm -f cpm.bin diskimage
+       rm -f BIOS.LST IPL.LST
+       rm -f *.REL *.PRN *.BIN *.COM
+       rm -f diskimage
 
 
-installcpm: cpm.bin
+installcpm: CPM.BIN
 ifneq (${DEV},)
-       sudo dd if=cpm.bin of=${DEV} bs=128 conv=sync oflag=sync
+       sudo dd if=CPM.BIN of=${DEV} bs=128 conv=sync oflag=sync
        sync
        sleep 1
        sync
@@ -47,7 +89,7 @@ install: diskimage
 ifneq (${DEV},)
        sudo dd if=diskimage of=${DEV} conv=sync oflag=direct,sync
        sync
-       cpmls -f avrcpm ${DEV}
+       cpmls -f $(IMGFORMAT) ${DEV}
        sync
        sleep 1
        sync
@@ -58,11 +100,12 @@ endif
 
 help:
        @echo -e "The following make targets are supported:\n"\
-       "    diskimage   - Build a complete CP/M image.\n"\
-       "    cpm.bin     - Build CP/M system (IPL+CCP+BDOS+BIOS).\n"\
+       "    diskimage   - Build a complete CP/M image. (default)\n"\
+       "    CPM.BIN     - Build CP/M system (IPL+CCP+BDOS+BIOS).\n"\
+       "    zsdossys    - Build ZSDOS system (IPL+CCP+ZSDOS+BIOS).\n"\
        "\n"\
-       "    bios.prn    - Make a listing file from bios.asm\n"\
-       "    ipl.prn     - Dito for ipl\n"\
+       "    BIOS.PRN    - Make a listing file from bios.asm\n"\
+       "    IPL.PRN     - Dito for ipl\n"\
        "\n"\
        "    install     - Copy diskimage to memory card.\n"\
        "                  You must specify the card device on the command line.\n"\
@@ -70,6 +113,6 @@ help:
        "    installcpm  - Like install, but install only the system tracks,\n"\
        "                  leaving the CP/M file system unaffected.\n"\
        "\n"\
-       "    clean       - Remove intermediate and output files.\n"
-
+       "    clean       - Remove intermediate and output files.\n"\
+       "    help        - Print this message and exit.\n"