dschmenk / PLASMA

Proto Language AsSeMbler for All (formerly Apple)
MIT License
194 stars 26 forks source link

Many dependencies on $(PLVM02) in the makefile #41

Open ZornsLemma opened 6 years ago

ZornsLemma commented 6 years ago

Hi Dave,

I'm updating my Acorn port to the latest master as a stepping stone to working on the new 2.0 stuff and I've noticed a small problem with the way the makefile is set up.

I found this "naturally" by trying to build my port, but you can see the problem most simply by taking current master HEAD (28571b4a350dc9bb91f5b7240e14cb0be5116f41) and applying this small patch:

diff --git a/src/makefile b/src/makefile
index ed475b1..e5c8573 100755
--- a/src/makefile
+++ b/src/makefile
@@ -78,7 +78,7 @@ TXTTYPE       = .TXT
 apple: $(PLVMZP_APL) $(PLASM) $(PLVM) $(PLVM01) $(PLVM02) $(PLVM802) $(PLVM03) $(CMD) $(PLASMAPLASM) $(CODEOPT) $(ARGS) $(MEMMGR) $(MEMTEST) $(FIBER) $(FIBERTEST) $(LONGJMP) $(ED) $(MON) $(SOS) $(ROD) $(SIEVE) $(UTHERNET2) $(UTHERNET) $(ETHERIP) $(INET) $(DHCP) $(HTTPD) $(ROGUE) $(ROGUEMAP) $(ROGUECOMBAT) $(GRAFIX) $(GFXDEMO) $(DGR) $(DGRTEST) $(FILEIO_APL) $(CONIO_APL) $(JOYBUZZ) $(PORTIO) $(SPIPORT) $(SDFAT) $(FATCAT) $(FATGET) $(FATPUT) $(FATWDSK) $(FATRDSK) $(SANE) $(FPSTR) $(FPU) $(SANITY) $(RPNCALC) $(SNDSEQ) $(PLAYSEQ)
        -rm vmsrc/plvmzp.inc

-c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64) 
+c64: $(PLVMZP_C64) $(PLASM) $(PLVM) $(PLVMC64) $(SIEVE)
        -rm vmsrc/plvmzp.inc

 all: apple c64
diff --git a/src/vmsrc/apple/plvm02.s b/src/vmsrc/apple/plvm02.s
index 9e58eac..2833a2f 100755
--- a/src/vmsrc/apple/plvm02.s
+++ b/src/vmsrc/apple/plvm02.s
@@ -9,6 +9,7 @@
 ;*
 ;* MONITOR SPECIAL LOCATIONS
 ;*
+!ERROR "FOO"
 CSWL    =       $36
 CSWH    =       $37
 PROMPT  =       $33

What this does is:

The problem is that if you do a C64 build, it fails because it's trying to build the Apple II code (because SIEVE depends on PLVM02):

$ make c64
...
acme -o rel/apple/PLASMA.SYSTEM#FF2000 -l vmsrc/apple/plvm02.sym vmsrc/apple/plvm02.s
Error - File vmsrc/apple/plvm02.s, line 12 (Zone <untitled>): !error: FOO
makefile:154: recipe for target 'rel/apple/PLASMA.SYSTEM#FF2000' failed
make: *** [rel/apple/PLASMA.SYSTEM#FF2000] Error 1

Obviously this example isn't very realistic and normally the Apple II code would build fine. What specifically triggered this in the case of my port is that I had removed JMPTMP from the Acorn plvmzp.inc and moved it into the Acorn plvm.s file. However, when building the Acorn port, the Apple PLVM02 gets built using the Acorn plvmzp.inc, and a mismatch occurs.

Now I could work around this by just ensuring that I define all the same symbols in the Acorn plvmzp.inc as are in the Apple plvmzp.inc, and that might be a good idea anyway, but I thought I should raise this as an issue anyway. It seems potentially confusing, maybe even dangerous, for building port X to build a broken (since it will use the wrong non-Apple zero page locations) version of the Apple II VM.

I don't have a great solution for this. I can hack around at the makefile and see if I can do anything with it, but I wanted to see how you felt about this before I do - if you don't see this as a problem then I won't worry about it. The obvious fix would be to remove the $(PLVM02) dependency from most of the demo files, but I don't know if that would have any unpleasant side efects.

Cheers.

Steve

dschmenk commented 6 years ago

Guess how upset I wouldn't be if we dumped this makefile and started from scratch :-)

ZornsLemma commented 6 years ago

Hah. :-) I'm having a go at a new version, I'll push a draft version up somewhere for you to take a look at soon-ish, maybe in a couple of hours.

ZornsLemma commented 6 years ago

OK, it's only a sketch but you might like to take a look at: https://github.com/ZornsLemma/PLASMA/tree/makefile-exp

The old makefile has been moved aside to makefile.old. There's now a new top-level makefile, a port-specific makefile.{apple,acorn} and a makefile.common.

You can do:

I doubt this will work with anything except GNU make; I don't know if that's a problem.