################################################################# ### File: Makefile.in ### Purpose: Makefile for omalloc ### Author: obachman@mathematik.uni-kl.de (Olaf Bachmann) ### Created: 11/99 ### Version: $Id$ ################################################################# SHELL = /bin/sh VERSION = @VERSION@ ## ## various paths ## prefix = @prefix@ exec_prefix = @exec_prefix@ # header file is installed here includedir = @includedir@ # library is installed here libdir = @libdir@ ## ## various programs ## @SET_MAKE@ CC = @CC@ AR = @AR@ RANLIB = @RANLIB@ PERL = @PERL@ LN_S = @LN_S@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ MKINSTALLDIRS = ./mkinstalldirs ## ## compiler and linker options ## CFLAGS = @CFLAGS@ CPPFLAGS = -I. @CPPFLAGS@ DEFS = @DEFS@ ## ## external config and and malloc files ## EXTERNAL_CONFIG_SOURCE = @EXTERNAL_CONFIG_SOURCE@ EXTERNAL_CONFIG_HEADER = @EXTERNAL_CONFIG_HEADER@ OM_MALLOC_HEADER = @OM_MALLOC_HEADER@ OM_MALLOC_SOURCE = @OM_MALLOC_SOURCE@ ## ## End configuration dependend stuff ################################################################# ### ### file sets ### # normal C source files CSOURCES= \ omBinPage.c omList.c omAllocEmulate.c omDebug.c \ om_Alloc.c omDebugCheck.c omOpts.c omGetBackTrace.c\ omAllocSystem.c omError.c omStats.c omRet2Info.c \ omBin.c omFindExec.c omDebugTrack.c \ omalloc_provide.c omAllocFunc.c ifdef EXTERNAL_CONFIG_SOURCE GSOURCES := ${GSOURCES} omExternalConfig.c endif ifdef OM_MALLOC_SOURCE GSOURCES := ${GSOURCES} omMalloc.c endif # ASO_SOURCES ASO_SOURCES = HEADERS= mylimits.h omlimits.h \ om_Alloc.h omList.h omDerivedConfig.h \ omAllocDecl.h omConfig.h omMemOps.h \ omDebug.h omOpts.h omInlineDecl.h \ omAllocPrivate.h omError.h omPage.h \ omAllocSystem.h omFindExec.h omStats.h \ omBin.h omDefaultConfig.h omStructs.h \ omBinPage.h omInline.h omGetBackTrace.h \ omReturn.h omRet2Info.h omAllocFunc.h OBJS := $(CSOURCES:.c=.o) $(GSOURCES:.c=.o) OBJS_NDEBUG := $(CSOURCES:.c=.o_ndebug) $(GSOURCES:.c=.o_ndebug) SOURCES=${CSOURCES} omGetPageSize.h omMallocSystem.h gmalloc.c dlmalloc.h dlmalloc.c \ omMmap.c gmalloc.c omTables.c pmalloc.h pmalloc.c omalloc.c omalloc_debug.c \ $(TESTSOURCES) omtTestAlloc.c ASO_OBJS := $(ASO_SOURCES:.aso.cc=.aso) DISTFILES=$(SOURCES) $(HEADERS) omtTest.h makeheader Makefile.in \ omConfig.h.in omlimits.h.in mylimits.h configure.in mkinstalldirs install-sh configure ## ## Build Targets ## %.o: %.c omConfig.h omlimits.h omTables.h omalloc.h omTables.inc ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $< %.o_ndebug: %.c omConfig.h omlimits.h mylimits.h omTables.h omalloc.h omTables.inc ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@ %.aso.o: %.aso.cc mmtables.inc ${CXX} ${CXXFLAGS} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} $< -o $@ .PRECIOUS: %.aso.o %.aso: %.aso.o ./$< > $@ all: libomalloc.a libomalloc_ndebug.a omalloc.h omalloc.o omalloc_debug.o lib: libomalloc.a libomalloc.a: $(OBJS) Makefile omConfig.h omlimits.h mylimits.h rm -f $@ $(AR) cr $@ $(OBJS) $(RANLIB) $@ libomalloc_ndebug.a: $(OBJS_NDEBUG) Makefile omConfig.h omlimits.h mylimits.h rm -f $@ $(AR) cr $@ $(OBJS_NDEBUG) $(RANLIB) $@ omalloc.h: $(HEADERS) omTables.h ./makeheader om_Alloc.h $@ omalloc.o: omalloc.c omalloc.h ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_NDEBUG -c $< -o $@ omalloc_debug.o: omalloc_debug.c omalloc.h ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -c $< -o $@ omTables.inc: omTables omalloc.h ./omTables > omTables.xx && mv omTables.xx $@ omTables.h: omTables ./omTables 1 >omTables.yy && mv omTables.yy $@ omTables: omAllocPrivate.h omConfig.h omTables.c omlimits.h mylimits.h ${CC} ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_GENERATE_INC omTables.c -o omTables # # targets to generate omExternalConfig.[c,h] # om_Alloc.h: omMalloc.h ifdef OM_MALLOC_SOURCE omMalloc.c: $(OM_MALLOC_SOURCE) cp $(OM_MALLOC_SOURCE) omMalloc.c endif ifdef EXTERNAL_CONFIG_SOURCE omExternalConfig.c: $(EXTERNAL_CONFIG_SOURCE) cp $(EXTERNAL_CONFIG_SOURCE) omExternalConfig.c endif ifdef EXTERNAL_CONFIG_HEADER omExternalConfig.h: $(EXTERNAL_CONFIG_HEADER) cp $(EXTERNAL_CONFIG_HEADER) omExternalConfig.h omDerivedConfig.h: omExternalConfig.h endif # # configure related stuff # omConfig.h omMalloc.h omlimits.h mylimits.h: stamp-h stamp-h : config.status omConfig.h.in omlimits.h.in ${OM_MALLOC_HEADER} CONFIG_FILES= CONFIG_HEADERS="omConfig.h omlimits.h omMalloc.h:${OM_MALLOC_HEADER}" ./config.status Makefile: Makefile.in config.status CONFIG_FILES="Makefile" CONFIG_HEADERS= ./config.status config.status: configure ./config.status --recheck configure: configure.in @echo "WARNING: You need to rerun autoconf. I am proceeding, for now." @touch configure # autoconf ## ## install targets ## install-nolns: install install-libsingular: $(MKINSTALLDIRS) $(includedir)/singular $(INSTALL) omalloc.h $(includedir)/singular install: all $(MKINSTALLDIRS) $(libdir) $(MKINSTALLDIRS) $(includedir) $(INSTALL_DATA) libomalloc.a $(libdir) $(RANLIB) $(libdir)/libomalloc.a $(INSTALL_DATA) libomalloc_ndebug.a $(libdir) $(RANLIB) $(libdir)/libomalloc_ndebug.a $(INSTALL_DATA) omalloc.o $(libdir) $(INSTALL_DATA) omalloc_debug.o $(libdir) $(INSTALL_DATA) omalloc.h $(includedir) $(INSTALL_DATA) omalloc.c $(includedir) $(INSTALL_DATA) omlimits.h $(includedir) $(INSTALL_DATA) mylimits.h $(includedir) install_all: install libomalloc_p.a $(INSTALL_DATA) libomalloc_p.a $(libdir) $(RANLIB) $(libdir)/libomalloc_p.a install_min: libomalloc_ndebug.a omalloc.o $(MKINSTALLDIRS) $(libdir) $(MKINSTALLDIRS) $(includedir) $(INSTALL_DATA) libomalloc_ndebug.a $(libdir) $(RANLIB) $(libdir)/libomalloc_ndebug.a $(INSTALL_DATA) omalloc.o $(libdir) $(INSTALL_DATA) omalloc.h $(includedir) $(INSTALL_DATA) omalloc.c $(includedir) $(INSTALL_DATA) omlimits.h $(includedir) $(INSTALL_DATA) mylimits.h $(includedir) uninstall: rm -f $(includedir)/omalloc.h $(includedir)/omalloc.c rm -f $(libdir)/libomalloc.a $(libdir)/libomalloc_ndebug.a $(libdir)/libomalloc_p.a $(libdir)/omalloc.o $(libdir)/omalloc_debug.o ## ## dist targets ## dist: omalloc-$(VERSION).tgz omalloc-$(VERSION).tgz: $(DISTFILES) rm -rf omalloc-$(VERSION) mkdir omalloc-$(VERSION) cp $(DISTFILES) omalloc-$(VERSION) tar czf omalloc-$(VERSION).tgz omalloc-$(VERSION) ## ## clean targest ## mostlyclean: -rm -f core *.d *.o *.og *.op *_d.c *.a depend *.out *.tgz omTables *.o_ndebug *.gp *.gprof -rm -f omtTest omtTest_* libomalloc* *.bprof omtTest omtTest_* -rm -f omMalloc.c omExternalConfig.h omExternalConfig.c clean: mostlyclean distclean: clean -rm -f *~ .\#* stamp-h omMalloc.h rm -rf omalloc-$(VERSION) -rm -f omalloc.h omTables.h omTables.inc -rm -f omConfig.h omlimits.h Makefile TAGS* tags config.status config.cache config.log srcclean: distclean maintainer-clean: distclean rm configure .PHONY: TAGS TAGS: omConfig.h.in omlimits.h.in etags omConfig.h.in omlimits.h.in $(SOURCES) $(HEADERS) ## ## check ## check: omtTest omtTest_ndebug ./omtTest ./omtTest_ndebug ## ## Below here is stuff for developpers ################################################################# ## ## compiler and linker options for debug version ## CCG = ${CC} CCM = gcc -MM -DGENERATE_DEPEND CFLAGSG = -g -O -fno-inline-functions -Wall DEFSG = @DEFS@ OBJG := $(CSOURCES:.c=.og) $(GSOURCES:.c=.og) %.og: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} -c $< -o $@ libg: libomalloc_g.a libomalloc_g.a: $(OBJG) Makefile omConfig.h mylimits.h omlimits.h rm -f $@ $(AR) cr $@ $(OBJG) $(RANLIB) $@ ## ## expanded macros ## OBJD := $(CSOURCES:%.c=%_d.og) $(GSOURCES:%.c=%_d.og) %_d.c : %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h $(CCG) -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@ .PRECIOUS: %_d.c libd: libomalloc_d.a libomalloc_d.a: $(OBJD) Makefile omConfig.h mylimits.h omlimits.h rm -f $@ $(AR) cr $@ $(OBJD) $(RANLIB) $@ #################################################### ## compiler and linker options for profile version ## CCP = ${CC} CFLAGSP = -g -pg -O3 DEFSP = @DEFS@ OBJP := $(CSOURCES:.c=.op) $(GSOURCES:.c=.op) ## ## Profile Targets ## %.op: %.c omConfig.h omTables.h omalloc.h mylimits.h omlimits.h $(CCP) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} -c $< -o $@ libp: libomalloc_p.a libomalloc_p.a: $(OBJP) Makefile omConfig.h mylimits.h omlimits.h rm -f $@ $(AR) cr $@ $(OBJP) $(RANLIB) $@ #################################################### ## Test program ## TESTSOURCES = omtTest.c omtTestReal.c omtTestDebug.c omtTestKeep.c omtTestError.c TEST_D := $(TESTSOURCES:.c=_d.og) omtTest_d: libd $(TEST_D) $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_D) -L. -lomalloc_d -o omtTest_d TEST_G := $(TESTSOURCES:.c=.og) omtTest_g: libg $(TEST_G) $(CCG) ${CFLAGSG} ${CPPFLAGS} ${DEFSG} $(TEST_G) -L. -lomalloc_g -o omtTest_g TEST_P := $(TESTSOURCES:.c=.op) omtTest_p: libp $(TEST_P) $(CCG) ${CFLAGSP} ${CPPFLAGS} ${DEFSP} $(TEST_P) -L. -lomalloc_p -o omtTest_p TEST_O := $(TESTSOURCES:.c=.o) omtTest: lib $(TEST_O) $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_O) -L. -lomalloc -o omtTest TEST_NDEBUG_O := $(TESTSOURCES:.c=.o_ndebug) omtTest_ndebug: libomalloc_ndebug.a $(TEST_NDEBUG_O) $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} $(TEST_NDEBUG_O) -DOM_NDEBUG -L. -lomalloc_ndebug -o omtTest_ndebug %.om : %.c omalloc.h $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC -c $< -o $@ TEST_M := $(TESTSOURCES:.c=.om) omtTest_m: lib $(TEST_M) $(CC) ${CFLAGS} ${CPPFLAGS} ${DEFS} -DOM_TEST_MALLOC $(TEST_M) -L. -lomalloc -o omtTest_m ## ## backup ## backup: omalloc-$(VERSION).tgz mcopy -o omalloc-$(VERSION).tgz a: ## ## Dependencies ## %.d: %.c omConfig.h mylimits.h Makefile omTables.h omTables.inc omalloc.h omlimits.h echo $(@:.d=.o_ndebug) $(@:.d=.og) $(@:.d=.od) $(@:.d=.op) $(@:.d=_d.c) $(@:.d=.om)" " \\ > $@ $(CCM) ${CPPFLAGS} ${DEFSG} $< >> $@ depend: $(CSOURCES:.c=.d) omConfig.h omlimits.h mylimits.h $(TESTSOURCES:.c=.d) cat *.d >depend ifeq (depend,$(wildcard depend)) include depend endif