From: paulfitch@emtwo.UUCP (Paul M Fitch)
Newsgroups: comp.os.os9
Subject: Re: COCO Lev 2 
Keywords: Make
Date: Sat, 21 Nov 92 09:40:10 EST
Distribution: na
Summary: A sample of a makefile
Organization: Pauls Center for the Study of MM/1s


 This is one makefile i'm using right now. Notice the MAINLINE var.

------------------------------cut here---------------------------------------

CC = cc1 
TARGET = sphere
ASM = rma 
ODIR = /dd/cmds
CFLAGS = -a -c -s
AFLAGS = 
LINK = rlink 
DELETE_FILE = del
LFLAGS = -M=10 
LIBS = -l=/dd/lib/sys.l -l=/dd/lib/pgfx.l -l=/dd/lib/gui.l -l=/dd/lib/cgfx.l  -l=/dd/lib/clibt.l
RFILES = sphere.r getwind.r setwind.r 
MAINLINE = /dd/lib/cstart.r

$(TARGET): $(RFILES)
          $(DELETE_FILE) $(ODIR)/$(TARGET)
          $(LINK) $(LFLAGS) $(MAINLINE) $(RFILES) $(LIBS) -o=$(ODIR)/$(TARGET)

setwind.a: setwind.c
           $(DELETE_FILE) $@
           $(CC) $(CFLAGS) $*.c 
setwind.r: setwind.a
           $(DELETE_FILE) $@
           $(ASM) $*.a $(AFLAGS) -o=$*.r

getwind.a: getwind.c
           $(DELETE_FILE) $@
           $(CC) $(CFLAGS) $*.c 
getwind.r: getwind.a
           $(DELETE_FILE) $@
           $(ASM) $*.a $(AFLAGS) -o=$*.r

sphere.a: sphere.c 
           $(DELETE_FILE) $@
           $(CC) $(CFLAGS) $*.c 
sphere.r: sphere.a
           $(DELETE_FILE) $@
           $(ASM) $*.a $(AFLAGS) -o=$*.r
------------------------------------cut here--------------------------------

#1. A simple CoCo C Compiler makefile for the program 'orb':
 *****************************************************************************
 
 * Makefile to compile orb
 
 ODIR=/dd/c/cmds
 RFILES=orb.r
 LIBFILES=-l=/dd/lib/cgfx.l -l=/dd/lib/sys.l
 
 orb: $(RFILES)
  cc orb.r $(LIBFILES) -f=$(ODIR)/orb
 
 orb.r: orb.c
  cc orb.c -r
 
 * end
 
 *****************************************************************************
 
 
 #2. A somewhat more complex makefile for the program 'd50':
 *****************************************************************************
 
 * Makefile to compile d50
 
 ODIR=/dd/c/cmds
 RDIR=RELS
 RFILES=$(RDIR)/setup.r $(RDIR)/key.r $(RDIR)/mscreen.r $(RDIR)/mgood.r $(RDIR)/mmidi.r $(RDIR)/bound.r $(RDIR)/penv.r
 LIBFILES=-l=/dd/lib/cgfx.l -l=/dd/lib/sys.l
 
 d50: $(RFILES)
  cc $(RFILES) $(LIBFILES) -f=$(ODIR)/d50
 
 setup.r: setup.c
  cc setup.c -r -o=$(RDIR)/setup.r
 
 key.r: key.c
  cc key.c -r -o=$(RDIR)/key.r
  
 mscreen.r: mscreen.c
  cc mscreen.c -r -o=$(RDIR)/mscreen.r
  
 mgood.r: mgood.c
  cc mgood.c -r -o=$(RDIR)/mgood.r
 
 mmidi.r: mmidi.c
  cc mmidi.c -r -o=$(RDIR)/mmidi.r
 
 bound.r: bound.c
  cc bound.c -r -o=$(RDIR)/bound.r
 
 penv.r: penv.c
  cc penv.c -r -o=$(RDIR)/penv.r
 
 * end
 
 *****************************************************************************
 
 
 #3. My most ambitious C project ever - also the biggest makefile I ever used.
 *****************************************************************************
 
 * Makefile to compile Graf
 
 ODIR = /dd/c/cmds
 RDIR = RELS
 RFILES=$(RDIR)/graf.r $(RDIR)/box.r $(RDIR)/bar.r $(RDIR)/circle.r $(RDIR)/line.r $(RDIR)/fill.r $(RDIR)/pencil.r $(RDIR)/arc.r $(RDIR)/ellipse.r $(RDIR)/palset.r $(RDIR)/cirfil.r $(RDIR)/erase.r $(RDIR)/vef.r
 LIBFILES=-l=/dd/lib/cgfx.l -l=/dd/lib/sys.l
 
 Graf: $(RFILES)
  cc $(RFILES) $(LIBFILES) -f=$(ODIR)/Graf
 
 graf.r: graf.c
  cc graf.c -r -o=$(RDIR)/graf.r
 
 box.r: box.c
  cc box.c -r -o=$(RDIR)/box.r
 
 bar.r: bar.c
  cc bar.c -r -o=$(RDIR)/bar.r
 
 circle.r: circle.c
  cc circle.c -r -o=$(RDIR)/circle.r
 
 line.r: line.c
  cc line.c -r -o=$(RDIR)/line.r
 
 fill.r: fill.c
  cc fill.c -r -o=$(RDIR)/fill.r
 
 pencil.r: pencil.c
  cc pencil.c -r -o=$(RDIR)/pencil.r
  
 arc.r: arc.c
  cc arc.c -r -o=$(RDIR)/arc.r
  
 ellipse.r: ellipse.c
  cc ellipse.c -r -o=$(RDIR)/ellipse.r
 
 palset.r: palset.c
  cc palset.c -r -o=$(RDIR)/palset.r
 
 cirfil.r: cirfil.c
  cc cirfil.c -r -o=$(RDIR)/cirfil.r
 
 erase.r: erase.c
  cc erase.c -r -o=$(RDIR)/erase.r
 
 vef.r: vef.c
  cc vef.c -r -o=$(RDIR)/vef.r
 
 * end
 
 *****************************************************************************
 
 
 #4. Now a simple CoCo assembler makefile for the program 'peel'
 *****************************************************************************
 
 * Makefile to compile peel
 
 ODIR=/dd/cmds
 RFILES=peel.r
 LIBFILES=-l=/dd/lib/sys.l -l=/dd/lib/alib.l
 
 peel: $(RFILES)
  rlink -o=$(ODIR)/peel $(LIBFILES) $(RFILES)
 
 peel.r: peel.a
  rma peel.a -o=peel.r
 
 * end
 
 *****************************************************************************
 
 
 #5. And a much more complex one for my program 'Snap'
 *****************************************************************************
 
 * Makefile to compile Snap
 
 ODIR=/dd/cmds
 RDIR=RELS
 RFILES=$(RDIR)/snap.r $(RDIR)/subr.r $(RDIR)/subr2.r $(RDIR)/find.r $(RDIR)/mod.r $(RDIR)/help.r $(RDIR)/ver.r
 LIBFILES=-l=/dd/lib/sys.l -l=/dd/lib/alib.l
 
 Snap: $(RFILES)
  rlink -o=$(ODIR)/snap $(LIBFILES) $(RFILES)
 
 snap.r: snap.a
  rma snap.a -o=$(RDIR)/snap.r
 
 subr.r: subr.a
  rma subr.a -o=$(RDIR)/subr.r
 
 subr2.r: subr2.a
  rma subr2.a -o=$(RDIR)/subr2.r
 
 find.r: find.a
  rma find.a -o=$(RDIR)/find.r
 
 mod.r: mod.a
  rma mod.a -o=$(RDIR)/mod.r
 
 help.r: help.a
  rma help.a -o=$(RDIR)/help.r
 
 ver.r: ver.a
  rma ver.a -o=$(RDIR)/ver.r
 
 * end
 
 *****************************************************************************
 
 
 #6. Here's a simple makefile for a MM/1 C program named 'balls'
 *****************************************************************************
 
 # Makefile for balls
 
 balls: balls.r 
   cc balls.r -l=/dd/lib/cgfx.l
  attr -pee -x balls
 
 balls.r: balls.c
   cc balls.c -R
 
 *****************************************************************************
 
 
 #7. And here's a simple makefile for a MM/1 assembler program called 'direct'
 *****************************************************************************
 
 * Makefile to compile direct
 
 RFILES=direct.r
 LIBFILES=-l=/dd/lib/sys.l
 
 direct: $(RFILES)
  l68 -o=direct $(LIBFILES) $(RFILES)
 
 direct.r: direct.a
  r68 direct.a -o=direct.r
 
 * end
 
 *****************************************************************************
 
 
 Hope these help anybody wondering how to get started with Make. I know I'm
 not using all the power available from Make, but it's still a big help. 
 Once you get the hang of creating basic makefiles, you can begin to
 understand the manual and learn from there.
 
  Glen Hathaway - COMPER - 71446,166
 
 
                                                         -- 
           / Applied OS9 BBS [1:363/18.6](407)327-6346 \   UUCP & FIDO
Paul Fitch | -->emtwo@DELPHI.com   OR                  |   on a $99.00
           \       ...!bilver!emtwo!paulfitch <--      /  Color Computer