[Coco] OS-9 / NitOS-9 C programmers, lend me your makefiles

William Carlin whcarlinjr at gmail.com
Thu Nov 12 12:11:53 EST 2020


OS-9 / NitOS-9 C programmers,

Share with me your most complex makefile(s).  I want to see what is
possible with both Tandy make and more specifically, Tim Koonce's (TK) make.

Most of my information is coming from the Tandy make documentation.
Getting information online seems to be mostly focused on GNU make, which is
vastly more advanced than what we had available in in 1991.  It's nearly
impossible to find documentation or examples of makefiles from the K&R C
era.

I am just getting my feet wet but here is my most complex example.  This is
a makefile to make Tim's make.

[Makefile]
# Makefile for make!

RDIR        = ../RELS
ODIR        = /dd/usr/src/make91/cmds/
EXEC        = make
DESTDIR     = /DD/TMP
USRBIN      = USR/BIN
CFLAGS      += -T=/R0 -e5 -dDEBUG
ROBJS       = $(RDIR/)check.r $(RDIR/)input.r $(RDIR/)macro.r
$(RDIR/)main.r \
$(RDIR/)make.r $(RDIR/)reader.r $(RDIR/)rules.r $(RDIR/)files.r
OBJS        = check.r input.r macro.r main.r make.r reader.r rules.r files.r
SRCS        = check.c input.c macro.c main.c make.c reader.c rules.c files.c

make:       $(OBJS)
            cc $(ROBJS) $(CFLAGS) -f=$(ODIR)$(EXEC)
            cp -ov $(ODIR)$(EXEC) /r0/$(EXEC)

$(OBJS):    h.h

$(ROBJS):   $(OBJS)

clean:      $(ROBJS)
            del $?
            del $(ODIR)$(EXEC)

copy:       $(EXEC)
            cp -ov $(ODIR)$(EXEC) /r0/$(EXEC)

install:    $(EXEC)
            makdir $(DESTDIR)/$(USRBIN)
            cp -ov $(ODIR)$(EXEC) $(DESTDIR)/$(USRBIN)/$(EXEC)
[EOF]

Notice the new '+=' operator for CFLAGS.  This is my current addition to TK
make that I am working on.  I wanted to keep the macro definitions from the
/dd/sys/make.default file and append what I am defining in the project
makefile to the existing definition.  The last part that is kicking my butt
is allowing a macro append from the command line.  It just keeps locking
up.  My debug code shows that I am processing the *argv correctly when the
macro is passed to the setmacro() function but then it goes udders up from
there.  Probably has to do with how I'm manipulating the pointers to char
or maybe with the malloc() space for char pointers.

William Carlin


More information about the Coco mailing list