# Makefile for generic C program # Last edited on 2005-02-04 07:35:10 by stolfi LIBNAME = libcpk HFILES := \ cpkbasic.h \ interval.h \ i2.h \ hexpaint.h \ cirpack.h NOT_HFILES := HOFILES := ${subst .h,.ho,${HFILES}} CFILES = \ cpkbasic.c \ interval.c \ i2.c \ hexpaint.c \ cirpack.c NOT_CFILES = \ next.c OFILES := ${subst .c,.o,${CFILES}} LIBFILE = \ ${LIBNAME}.a SHELL = /bin/sh .PHONY: all build check clean depend # all: clean build check # all: clean build # all: clean build tests all: build build: ${LIBFILE} # ==================================================================== # Cleanup clean: -/bin/rm -f *.o *.ho *.a core ${LIBFILE} ( cd ${TESTDIR} && ${MAKE} clean ) # ==================================================================== # Testing the library TESTDIR := tests check: ${LIBFILE} ( cd ${TESTDIR} && ${MAKE} all ) # ==================================================================== # Compiling, linking, building libraries # Where to find Stolfi's includes and libraries JSPUB := /home/staff/stolfi/PUB JSLIB := ${JSPUB}/${PLATFORM}/lib JSINC := ${JSPUB}/include CC := gcc \ -Wall -Wpointer-arith -Wmissing-prototypes \ -fpcc-struct-return CFLAGS := -O -g LDFLAGS := IFLAGS := -I. -I${JSINC} %.o: %.c ${CC} ${CFLAGS} ${IFLAGS} -c $*.c %.ho: %.h ${CC} ${CFLAGS} ${IFLAGS} -o $*.ho -c -x c $*.h \ || /bin/rm -f $*.ho ${LIBFILE}: ${HOFILES} ${OFILES} rm -f $*.a && ar crv $*.a ${OFILES} && ranlib $*.a # ==================================================================== # Dependencies DEPFILE := Deps.make depend: /bin/rm -f ${DEPFILE} extract-ho-deps ${IFLAGS} -I/usr/include ${HFILES} ${CFILES} \ | egrep -v ': /usr/include' \ > ${DEPFILE} # Include specific dependencies extracted by "make depend" include ${DEPFILE}