# Last edited on 2008-01-13 01:06:19 by stolfi

# Installation directories:
# INSTALLDIR = INSTALLDIR_IS_UNDEFINED
INSTALLDIR = ~/PUB/${PLATFORM}
INC = $(INSTALLDIR)/gcc/include
LIB = $(INSTALLDIR)/lib
BIN = $(INSTALLDIR)/bin
MAN = $(INSTALLDIR)/man/cat1

HFILES =

HOFILES =

OFILES =
  
PROG = \
  bool
  
MANPAGE = \
  $(PROG).1

MAINOBJ = \
  $(PROG).o
  
LIBS =
  
GCCFLAGS = \
  -I$(INC) \
  -g \
  -ansi \
  -Wall -Wtraditional -Wpointer-arith -Wmissing-prototypes
  
.PHONY: all cleanup uninstall install

all:   uninstall $(PROG) install

cleanup: ;\
  rm -f $(HOFILES) $(OFILES) $(MAINOBJ) $(PROG)
  
uninstall: ;\
  ( cd $(BIN) && rm -f $(PROG) ) ;\
  ( cd $(MAN) && rm -f $(MANPAGE) )
  
%.o: %.c ;\
  gcc -c $(GCCFLAGS) $*.c
  
%.ho: %.h ;\
  gcc -o $*.ho -c $(GCCFLAGS) -x c $*.h \
  || /bin/rm -f $*.ho
  
$(PROG): $(OFILES) $(MAINOBJ) $(LIBS) ;\
  gcc -o $(PROG) $(MAINOBJ) $(OFILES) $(LIBS) -lm

install: ;\
  cp -p $(PROG) $(BIN) ;\
  cp -p $(MANPAGE) $(MAN)

# Dependencies of .h files: 
  
# Dependencies for .c files:

bool.o::  bool.c