[pdp7-unix] "original-commands" branch

Phil Budne phil at ultimate.com
Mon Oct 28 04:55:12 AEST 2019


> I'm not sure what level of Makefile tricks is desired here.  For your
> consideration, I believe many rules like this:
>
> $(BINDIR)/sh: $(CMDSRC)/sh.s
>         $(AS) $(ASARGS) -o $(BINDIR)/sh $(CMDSRC)/sh.s
>
> can be replaced by a single implicit rule such as:
>
> $(BINDIR)/%: $(CMDSRC)/%.s
>         $(AS) $(ASARGS) -o $@ $^
>
> This wouldn't work for files built from several source files though.

Thanks!  I had tried to figure out a way to make

$(BINDIR)/sh: $(CMDSRC)/sh.s

$(BINDIR)/thing: $(CMDSRC)/thing1.s $(CMDSRC)/thing2.s

"do the right thing", but failed.

Personally, I think less in a Makefile is easier to understand, up to
a point (too much magic can be confusing as much as repeated and
unnecessary noise), so (as always) it's a balancing act.

But GNU make isn't really my thing (I still do work on FreeBSD where
BSD make is the default), so I don't know all the tricks of the trade,
and I GENERALLY try to stick to a portable subset. Plus I don't know
which gmake constructs are "portable" (have existed forever) and which
are not, so I was content to leave that judgement to someone else.

Since there are sources in places other than CMDSRC (and it's possible
that CMDSRC could be split up, say by adding GAMESRC), having an
implicit rule with CMDSRC wired bothers me slightly.

Something I'd like to eventually see would be to create the disk image
with a "cold start" paper tape, and load the sources and minimal
binaries via paper tape, and then regenerate all the binaries natively
(either thru SimH scripting, or supplied "rc" files), so spending a
lot of time crafting the ultimate Makefile isn't how I would spend my
time!


More information about the pdp7-unix mailing list