From: bcwhite@babbage.uwaterloo.ca (Brian C. White)
Subject: GCC Makefile
Organization: University of Waterloo
Date: Thu, 21 Jan 1993 15:36:01 GMT

Some people have been saying that they can't get GCC or GPP to work with
the standard Microware 'make' utility.  I've included my makefile template
below.

The uWare 'make' is not nearly so bad as people claim.  I havn't found a
task where it won't work with a little message.  There are also some
features of it which are undocumented.  For example you can, unlike v7make,
redefine the builtin rules for making ".r" files from ".c" files.  Also,
the first line of the makefile is read as though it was put on the command
line (I usually put "-bo" on the first line for this reason).

Anyway, here is my makefile template...  To use GPP, just change $(CC).

-bo
******************************************************************************
**
**   MyProject -- MakeFile
**

SDIR = /wherever                # Directory where source files can be found
ODIR = /R0                      # Directory where output files are to be kept
LIB  = /DD/LIB                  # Directory where library files can be found
DDIR = /DD/DEFS                 # Directory where .h files can be found
RDIR = /H2/RELS/wherever        # Directory where .r files are to be kept
TDIR = /R0                      # Directory where temp files are to be kept

CC      = gcc                                           # Use GCC
#CDEBUG = -fomit-frame-pointer                          # Debug flags
CDEBUG  = -DDEBUG -g -W                                 # Debug flags
CINCL   =                                               # Extra header file dir
COPTS   =                                               # Compiler options
COPTMZ1 = -o68 -O -fstrength-reduce -fforce-mem         # Compiler optimization
COPTMZ2 = -fcombine-regs -fdefer-pop                    # Compiler optimization
COPTMZ  = $(COPTMZ1) $(COPTMZ2)                         # Compiler optimization
#COPTMZ =                                               # Compiler optimization
CFLAGS  = $(CDEBUG) $(COPTS) $(COPTMZ) $(CINCL)         # All flags together

ASM     = r68                                           # Assembler program
AFLAGS  = -q                                            # Assembler flags

LMODULE = -e=1 -p=0555                                  # Module settings
LOPTS   =                                               # Link options
LLIBS   = -L$(LIB)/GCC -L$(LIB)/USR                     # More lib dirs
LFLAGS  = $(LOPTS)

P2C     = p2c                                           # Pascal preprocessor

STDLIBS = -l=$(LIB)/GCC/gnulib.l -l=$(LIB)/clibn.l -l=$(LIB)/math.l -l=$(LIB)/usr.l
CPPLIBS = -l=$(LIB)/GCC/libgpp.l -l=$(LIB)/GCC/gpp.l    # C++ libraries
CIO     = -l=$(LIB)/cio.l                               # Use CIO
CGFX    = -l=$(LIB)/USR/cgfx.l                          # Graphic routines
PLIB    = -l=$(LIB)/P2C/libp2c.l                        # Pascal (p2c)
RAND    = -l=$(LIB)/USR/rand.l                          # Random numbers
CURSES  = -l=$(LIB)/USR/effocurses.l                    # Curses
TERMCAP = -l=$(LIB)/termlib.l                           # Termcap
BLARSLIB= -l=$(LIB)/USR/blarslib.l                      # B.Larson Unix stuff
OS9LIB  = -l=$(LIB)/USR/os9lib.l                        # OS9 Unix stuff

OFLAGS  = $(CPPLIBS)                                    # "Collect" (GPP) flags

*----------------------------------------------------------------------------*

maze:       maze.r
            l68 $(LIB)/cstart.r $(RDIR)/$*.r $(CGFX) $(RAND) $(STDLIBS) \
            -e=1 -p=0555 -o=$(ODIR)/$@

stformat:   stformat.r
            l68 $(LIB)/cstart.r $(RDIR)/$*.r $(STDLIBS) \
            -l=/dd/usr/dcmd.l -e=1 -p=0555 -o=$(ODIR)/$@

vt100:      vt100.r
            l68 $(LIB)/cstart.r $(RDIR)/$*.r $(STDLIBS) \
            -e=1 -p=0555 -o=$(ODIR)/$@

alias:      dummy.r
            l68 $(RDIR)/dummy.r -o=$(ODIR)/$@ -l=$(LIB)/usr.l

cleantdir:  always
            @dir $(TDIR) >-$(TDIR)/mydir
            del $(TDIR)/*

*----------------------------------------------------------------------------*

.c.r:
    $(CC) $*.c -c -o $(RDIR)/$*.r $(CFLAGS)
.c.a:
    $(CC) $*.c -c -o $(TDIR)/$*.a $(CFLAGS) -S
.a.r:
    r68 $*.a -o=$(RDIR)/$*.r 
.p.r:
    $(P2C) $*.p -v -o $(TDIR)/$*.c #16k
    $(CC) $(TDIR)/$*.c -c -o $(RDIR)/$*.r $(CFLAGS)

vt100.r:    vt100.c
dummy.r:    dummy.a

Newsgroups: comp.os.os9