# Generic Makefile for a single executable program # Last edited on 2007-10-09 20:36:42 by stolfi PROGS := \ principalRGB \ principal SHELL := /bin/bash # Localização da biblioteca GL: GLLIB := /usr/lib # Localização das bibliotecas X11 (supõe-se que inclui ICE): X11INC := /usr/X11R6/include X11LIB := /usr/X11R6/lib ###################################################################### # "No user-serviceable parts inside!" # You should not have to change anything below this line. # Get list of main program source files: PROG_CFILES := ${addsuffix .c,${PROGS}} # Get list of source files (excluding the main ones): HFILES := ${wildcard *.h} CFILES := ${filter-out ${PROG_CFILES},${wildcard *.c}} # Derived object files (excluding the main ones): HOFILES := ${subst .h,.ho,${HFILES}} OFILES := ${subst .c,.o,${CFILES}} # Make targets: .PHONY: \ depend \ all \ build build-progs build-single check \ archive clean all: build # Directories to search for #include files: IFLAGS := -I. # File with dependencies between sources: DEPFILE := Deps.make # This file must be present to run "make"; # create an empty one if necessary. include ${DEPFILE} #--------------------------------------------------------------------- # "make depend" recreates the source dependency file ${DEPFILE}. depend: /bin/rm -f ${DEPFILE} ./extract-ho-deps ${IFLAGS} -I/usr/include \ ${HFILES} ${CFILES} ${PROG_CFILES} \ | egrep -v ': /usr/include' \ > ${DEPFILE} #--------------------------------------------------------------------- # "make build" assumes that the dependencies in ${DEPFILE} # are up-to-date. build: ${HOFILES} ${OFILES} build-progs # Get OpenGL libraries is requested: ifeq "/${USEGL}" "/YES" GL_LIBRARIES := \ ${GLLIB}/libglut.so \ ${GLLIB}/libGLU.so \ ${GLLIB}/libGL.so else GL_LIBRARIES := endif # Get X11 libraries if requested: ifeq "/${USEX11}" "/YES" X11_LIBRARIES := \ ${X11LIB}/libX11.so \ ${X11LIB}/libXext.so \ ${X11LIB}/libXmu.so \ ${X11LIB}/libXt.so \ ${X11LIB}/libXi.so \ ${X11LIB}/libSM.so \ ${X11LIB}/libICE.so else X11_LIBRARIES := endif LIBRARIES := \ ${GL_LIBRARIES} \ ${X11_LIBRARIES} \ ${OTHERLIBS} CC := /usr/bin/gcc CFLAGS := \ -ggdb -O -ffloat-store -frounding-math \ -Wall -Wpointer-arith -Wmissing-prototypes \ -fpcc-struct-return LDFLAGS := \ -ggdb %.o: %.c ${CC} -c ${CFLAGS} ${EXTRACFLAGS} ${IFLAGS} $*.c %.ho: %.h ${CC} -o $*.ho -c ${CFLAGS} ${IFLAGS} -x c $*.h \ || /bin/rm -f $*.ho build-progs: @echo PROG_CFILES = "${PROG_CFILES}" @echo CFILES = "${CFILES}" for p in ${PROGS} ; do \ ${MAKE} PROG=$$p build-single ; \ done ifneq "/${PROG}" "/" build-single: ${PROG} ${PROG}: ${PROG}.o ${OFILES} ${LIBRARIES} -rm -f ${PROG} ${CC} -o ${PROG} ${LDFLAGS} ${PROG}.o \ ${OFILES} \ ${LIBRARIES} -lm -lrt endif # Include specific dependencies extracted by "make depend" include ${DEPFILE} #--------------------------------------------------------------------- # "make archive" creates a tarball of sources and executable. TARGZ := tarfile.tgz archive: tar -cvzf ${TARGZ} \ 00-README Makefile \ ${PROGS} \ ${HFILES} ${CFILES} ${PROG_CFILES} #--------------------------------------------------------------------- # "make clean" deletes all derived files. TESTDIR := tests clean: -/bin/rm -f *.o *.ho *.a core ${PROGS} if [[ -d ${TESTDIR} ]]; then ( cd ${TESTDIR} && ${MAKE} clean ) fi # affirm.ho: ${filter-out affirm.ho,${HOFILES}} affirm.h # argparser.ho: ${filter-out argparser.ho,${HOFILES}} argparser.h # bool.ho: ${filter-out bool.ho,${HOFILES}} bool.h # fget.ho: ${filter-out fget.ho,${HOFILES}} fget.h # filefmt.ho: ${filter-out filefmt.ho,${HOFILES}} filefmt.h # float_image.ho: ${filter-out float_image.ho,${HOFILES}} float_image.h # float_pnm_image.ho: ${filter-out float_pnm_image.ho,${HOFILES}} float_pnm_image.h # indexing.ho: ${filter-out indexing.ho,${HOFILES}} indexing.h # jsfile.ho: ${filter-out jsfile.ho,${HOFILES}} jsfile.h # jsmath.ho: ${filter-out jsmath.ho,${HOFILES}} jsmath.h # jspnm.ho: ${filter-out jspnm.ho,${HOFILES}} jspnm.h # jspnm_image.ho: ${filter-out jspnm_image.ho,${HOFILES}} jspnm_image.h # jsrandom.ho: ${filter-out jsrandom.ho,${HOFILES}} jsrandom.h # jsstring.ho: ${filter-out jsstring.ho,${HOFILES}} jsstring.h # List.ho: ${filter-out List.ho,${HOFILES}} List.h # nget.ho: ${filter-out nget.ho,${HOFILES}} nget.h # preprocessar.ho: ${filter-out preprocessar.ho,${HOFILES}} preprocessar.h # principal.ho: ${filter-out principal.ho,${HOFILES}} principal.h # principalRGB.ho: ${filter-out principalRGB.ho,${HOFILES}} principalRGB.h # reducao.ho: ${filter-out reducao.ho,${HOFILES}} reducao.h # reducaoRGB.ho: ${filter-out reducaoRGB.ho,${HOFILES}} reducaoRGB.h # ref.ho: ${filter-out ref.ho,${HOFILES}} ref.h # sign.ho: ${filter-out sign.ho,${HOFILES}} sign.h # vec.ho: ${filter-out vec.ho,${HOFILES}} vec.h # # preprocessar.o: ${HOFILES} preprocessar.c # principalRGB.o: ${HOFILES} principalRGB.c # affirm.o: ${HOFILES} affirm.c # argparser.o: ${HOFILES} argparser.c # bool.o: ${HOFILES} bool.c # fget.o: ${HOFILES} fget.c # filefmt.o: ${HOFILES} filefmt.c # float_image.o: ${HOFILES} float_image.c # float_pnm_image.o: ${HOFILES} float_pnm_image.c # indexing.o: ${HOFILES} indexing.c # jsfile.o: ${HOFILES} jsfile.c # jsmath.o: ${HOFILES} jsmath.c # jspnm.o: ${HOFILES} jspnm.c # jspnm_image.o: ${HOFILES} jspnm_image.c # jsrandom.o: ${HOFILES} jsrandom.c # jsstring.o: ${HOFILES} jsstring.c # List.o: ${HOFILES} List.c # nget.o: ${HOFILES} nget.c # preprocessar.o: ${HOFILES} preprocessar.c # principal.o: ${HOFILES} principal.c # principalRGB.o: ${HOFILES} principalRGB.c # reducao.o: ${HOFILES} reducao.c # reducaoRGB.o: ${HOFILES} reducaoRGB.c # vec.o: ${HOFILES} vec.c