home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 19.4 Special Target Names Chapter 19
The make Utility
Next: 20. Program Debugging
 

19.5 Sample Default Macros, Suffixes, and Rules

EDITOR = /usr/bin/vi
TERM = tvi950ns
SHELL = /bin/sh
PATH = .:/bin:/usr/bin:/usr/fred:/usr/local
LOGNAME = fred
HOME = /usr/fred
GFLAGS = 
GET = get
ASFLAGS = 
AS = as
FFLAGS = 
FC = f77
CFLAGS = -O
CC = cc
LDFLAGS = 
LD = ld
LFLAGS = 
LEX = lex
YFLAGS = 
YACC = yacc
MAKE = make
$ = $
MAKEFLAGS = b

.h~.h:
     $(GET) $(GFLAGS) -p $< > $*.h

.s~.a:
     $(GET) $(GFLAGS) -p $< > $*.s
     $(AS) $(ASFLAGS) -o $*.o $*.s
     ar rv $@ $*.o
     -rm -f $*.[so]

.r~.a:
     $(GET) $(GFLAGS) -p $< > $*.r
     $(FC) -c $(FFLAGS) $*.r
     ar rv $@ $*.o
     rm -f $*.[ro]

.e~.a:
     $(GET) $(GFLAGS) -p $< > $*.e
     $(FC) -c $(FFLAGS) $*.e
     ar rv $@ $*.o
     rm -f $*.[eo]

.f~.a:
     $(GET) $(GFLAGS) -p $< > $*.f
     $(FC) -c $(FFLAGS) $*.f
     ar rv $@ $*.o
     rm -f $*.[fo]

.r.a:
     $(FC) -c $(FFLAGS) $<
     ar rv $@ $*.o
     rm -f $*.o

.e.a:
     $(FC) -c $(FFLAGS) $<
     ar rv $@ $*.o
     rm -f $*.o

.f.a:
     $(FC) -c $(FFLAGS) $<
     ar rv $@ $*.o
     rm -f $*.o

.c~.a:
     $(GET) $(GFLAGS) -p $< > $*.c
     $(CC) -c $(CFLAGS) $*.c
     ar rv $@ $*.o
     rm -f $*.[co]

.c.a:
     $(CC) -c $(CFLAGS) $<
     ar rv $@ $*.o
     rm -f $*.o

.l.c:
     $(LEX) $<
     mv lex.yy.c $@

.y~.c:
     $(GET) $(GFLAGS) -p $< > $*.y
     $(YACC) $(YFLAGS) $*.y
     mv y.tab.c $*.c
     -rm -f $*.y

.y.c:
     $(YACC) $(YFLAGS) $<
     mv y.tab.c $@

.l~.o:
     $(GET) $(GFLAGS) -p $< > $*.l
     $(LEX) $(LFLAGS) $*.l
     $(CC) $(CFLAGS) -c lex.yy.c
     rm -f lex.yy.c $*.l
     mv lex.yy.o $*.o

.l.o:
     $(LEX) $(LFLAGS) $<
     $(CC) $(CFLAGS) -c lex.yy.c
     rm lex.yy.c
     mv lex.yy.o $@

.y~.o:
     $(GET) $(GFLAGS) -p $< > $*.y
     $(YACC) $(YFLAGS) $*.y
     $(CC) $(CFLAGS) -c y.tab.c
     rm -f y.tab.c $*.y
     mv y.tab.o $*.o

.y.o:
     $(YACC) $(YFLAGS) $<
     $(CC) $(CFLAGS) -c y.tab.c
     rm y.tab.c
     mv y.tab.o $@

.s~.o:
     $(GET) $(GFLAGS) -p $< > $*.s
     $(AS) $(ASFLAGS) -o $*.o $*.s
     -rm -f $*.s

.s.o:
     $(AS) $(ASFLAGS) -o $@ $<

.r~.o:
     $(GET) $(GFLAGS) -p $< > $*.r
     $(FC) $(FFLAGS) -c $*.r
     -rm -f $*.r

.e~.e:
     $(GET) $(GFLAGS) -p $< > $*.e

.e~.o:
     $(GET) $(GFLAGS) -p $< > $*.e
     $(FC) $(FFLAGS) -c $*.e
     -rm -f $*.e

.f~.f:
     $(GET) $(GFLAGS) -p $< > $*.f

.f~.o:
     $(GET) $(GFLAGS) -p $< > $*.f
     $(FC) $(FFLAGS) -c $*.f
     -rm -f $*.f

.r.o:
     $(FC) $(FFLAGS) -c $<

.e.o:
     $(FC) $(FFLAGS) -c $<

.f.o:
     $(FC) $(FFLAGS) -c $<

.c~.c:
     $(GET) $(GFLAGS) -p $< > $*.c

.c~.o:
     $(GET) $(GFLAGS) -p $< > $*.c
     $(CC) $(CFLAGS) -c $*.c
     -rm -f $*.c

.c.o:
     $(CC) $(CFLAGS) -c $<

.sh~:
     $(GET) $(GFLAGS) -p $< > $*.sh
     cp $*.sh $*
     -rm -f $*.sh

.sh:
     cp $< $@

.r~:
     $(GET) $(GFLAGS) -p $< > $*.r
     $(FC) -n $(FFLAGS) $*.r -o $*
     -rm -f $*.r

.r:
     $(FC) $(FFLAGS) $(LDFLAGS) $< -o $@

.e~:
     $(GET) $(GFLAGS) -p $< > $*.e
     $(FC) -n $(FFLAGS) $*.e -o $*
     -rm -f $*.e

.e:
     $(FC) $(FFLAGS) $(LDFLAGS) $< -o $@

.f~:
     $(GET) $(GFLAGS) -p $< > $*.f
     $(FC) -n $(FFLAGS) $*.f -o $*
     -rm -f $*.f

.f:
     $(FC) $(FFLAGS) $(LDFLAGS) $< -o $@

.c~:
     $(GET) $(GFLAGS) -p $< > $*.c
     $(CC) -n $(CFLAGS) $*.c -o $*
     -rm -f $*.c

.c:
     $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@

.SUFFIXES: 
&     .o  .c  .c~  .f  .f~  .e  .e~  .r  .r~  
&     .y  .y~  .l  .l~  .s  .s~  .sh  .sh~  .h  .h~


Previous: 19.4 Special Target Names UNIX in a Nutshell: System V Edition Next: 20. Program Debugging
19.4 Special Target Names Book Index 20. Program Debugging

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System