introduce makefile_include.mk
this also fixes a bug where makefile.shared didn't always use $(LT) instead of libtool
This commit is contained in:
parent
6c1b3e2424
commit
e632e097c8
104
makefile
104
makefile
@ -1,9 +1,16 @@
|
||||
#makefile for TomsFastMath
|
||||
#
|
||||
#
|
||||
VERSION=0.13.1-next
|
||||
ifndef LIBNAME
|
||||
LIBNAME=libtfm.a
|
||||
endif
|
||||
|
||||
INSTALL_CMD = install
|
||||
UNINSTALL_CMD = rm
|
||||
|
||||
|
||||
include makefile_include.mk
|
||||
|
||||
CFLAGS += -Wall -W -Wshadow -Isrc/headers
|
||||
|
||||
# Compiler and Linker Names
|
||||
ifndef PREFIX
|
||||
@ -33,24 +40,6 @@ ifneq ($V,1)
|
||||
endif
|
||||
${silent} ${CC} ${CFLAGS} -c $< -o $@
|
||||
|
||||
ifdef COMPILE_DEBUG
|
||||
#debug
|
||||
CFLAGS += -g3
|
||||
else
|
||||
ifndef IGNORE_SPEED
|
||||
|
||||
CFLAGS += -O3 -funroll-loops
|
||||
|
||||
#profiling
|
||||
#PROF=-pg -g
|
||||
#CFLAGS += $(PROF)
|
||||
|
||||
#speed
|
||||
CFLAGS += -fomit-frame-pointer
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
#START_INS
|
||||
OBJECTS=src/addsub/fp_add.o src/addsub/fp_add_d.o src/addsub/fp_addmod.o src/addsub/fp_cmp.o \
|
||||
src/addsub/fp_cmp_d.o src/addsub/fp_cmp_mag.o src/addsub/fp_sub.o src/addsub/fp_sub_d.o \
|
||||
@ -82,48 +71,15 @@ HEADERS=src/headers/tfm_private.h $(HEADERS_PUB)
|
||||
|
||||
#END_INS
|
||||
|
||||
ifndef LIBPATH
|
||||
LIBPATH=/usr/lib
|
||||
endif
|
||||
|
||||
ifndef INCPATH
|
||||
INCPATH=/usr/include
|
||||
endif
|
||||
|
||||
ifndef INSTALL_GROUP
|
||||
GROUP=wheel
|
||||
else
|
||||
GROUP=$(INSTALL_GROUP)
|
||||
endif
|
||||
|
||||
ifndef INSTALL_USER
|
||||
USER=root
|
||||
else
|
||||
USER=$(INSTALL_USER)
|
||||
endif
|
||||
|
||||
ifndef LIBNAME
|
||||
LIBNAME=libtfm.a
|
||||
endif
|
||||
|
||||
default: $(LIBNAME)
|
||||
|
||||
$(OBJECTS): $(HEADERS)
|
||||
|
||||
$(LIBNAME): $(OBJECTS)
|
||||
$(AR) $(ARFLAGS) $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
install: $(LIBNAME)
|
||||
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
|
||||
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
|
||||
install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
|
||||
install -g $(GROUP) -o $(USER) $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
|
||||
install: .common_install
|
||||
|
||||
HEADER_FILES=$(notdir $(HEADERS_PUB))
|
||||
uninstall:
|
||||
rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
|
||||
rm $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)
|
||||
uninstall: .common_uninstall
|
||||
|
||||
.PHONY: mtest
|
||||
mtest: $(LIBNAME)
|
||||
@ -215,44 +171,6 @@ docs: docdvi
|
||||
mv tfm.bak tfm.tex
|
||||
mv -f tfm.pdf doc
|
||||
|
||||
#This rule cleans the source tree of all compiled code, not including the pdf
|
||||
#documentation.
|
||||
clean:
|
||||
rm -f `find . -type f -name "*.o" | xargs`
|
||||
rm -f `find . -type f -name "*.lo" | xargs`
|
||||
rm -f `find . -type f -name "*.a" | xargs`
|
||||
rm -f `find . -type f -name "*.la" | xargs`
|
||||
rm -f `find . -type f -name "*.obj" | xargs`
|
||||
rm -f `find . -type f -name "*.lib" | xargs`
|
||||
rm -f `find . -type f -name "*.exe" | xargs`
|
||||
rm -f `find . -type f -name "*.gcov" | xargs`
|
||||
rm -f `find . -type f -name "*.gcda" | xargs`
|
||||
rm -f `find . -type f -name "*.gcno" | xargs`
|
||||
rm -f `find . -type f -name "*.il" | xargs`
|
||||
rm -f `find . -type f -name "*.dyn" | xargs`
|
||||
rm -f `find . -type f -name "*.dpi" | xargs`
|
||||
rm -rf `find . -type d -name "*.libs" | xargs`
|
||||
rm -f tfm.aux tfm.dvi tfm.idx tfm.ilg tfm.ind tfm.lof tfm.log tfm.out tfm.toc test test.exe
|
||||
cd mtest; MAKE=${MAKE} ${MAKE} clean
|
||||
|
||||
.PHONY: pre_gen
|
||||
pre_gen:
|
||||
perl gen.pl
|
||||
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
|
||||
rm mpi.c
|
||||
|
||||
zipup:
|
||||
rm -rf ../tomsfastmath-$(VERSION) && rm -f ../tfm-$(VERSION).zip ../tfm-$(VERSION).tar.bz2 && \
|
||||
expsrc.sh -i . -o ../tomsfastmath-$(VERSION) --svntags --no-fetch -p '*.c' -p '*.h' && \
|
||||
MAKE=${MAKE} ${MAKE} -C ../tomsfastmath-$(VERSION) docs && \
|
||||
tar -c ../tomsfastmath-$(VERSION)/* | xz -cz > ../tfm-$(VERSION).tar.xz && \
|
||||
find ../tomsfastmath-$(VERSION)/ -type f -exec unix2dos -q {} \; && \
|
||||
zip -9 -r ../tfm-$(VERSION).zip ../tomsfastmath-$(VERSION)/* && \
|
||||
gpg -b -a ../tfm-$(VERSION).tar.xz && gpg -b -a ../tfm-$(VERSION).zip
|
||||
|
||||
new_file:
|
||||
bash updatemakes.sh
|
||||
|
||||
# $Source$
|
||||
# $Revision$
|
||||
# $Date$
|
||||
|
@ -1,25 +1,20 @@
|
||||
#makefile for TomsFastMath
|
||||
#
|
||||
#
|
||||
VERSION=1:0:0
|
||||
ifndef LIBNAME
|
||||
LIBNAME=libtfm.la
|
||||
endif
|
||||
|
||||
LT ?= libtool
|
||||
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
|
||||
|
||||
CFLAGS += -Wall -W -Wshadow -Isrc/headers
|
||||
INSTALL_CMD = $(LT) --mode=install install
|
||||
UNINSTALL_CMD = $(LT) --mode=uninstall rm
|
||||
|
||||
ifndef IGNORE_SPEED
|
||||
|
||||
CFLAGS += -O3 -funroll-all-loops
|
||||
include makefile_include.mk
|
||||
|
||||
#profiling
|
||||
#PROF=-pg -g
|
||||
#CFLAGS += $(PROF)
|
||||
|
||||
#speed
|
||||
CFLAGS += -fomit-frame-pointer
|
||||
|
||||
endif
|
||||
|
||||
#START_INS
|
||||
OBJECTS=src/addsub/fp_add.o src/addsub/fp_add_d.o src/addsub/fp_addmod.o src/addsub/fp_cmp.o \
|
||||
@ -55,38 +50,17 @@ HEADERS=src/headers/tfm_private.h $(HEADERS_PUB)
|
||||
#END_INS
|
||||
|
||||
|
||||
DESTDIR ?= /usr/local
|
||||
LIBPATH ?= $(DESTDIR)/lib
|
||||
INCPATH ?= $(DESTDIR)/include
|
||||
|
||||
ifndef LIBNAME
|
||||
LIBNAME=libtfm.la
|
||||
endif
|
||||
|
||||
ifndef LIBNAME_S
|
||||
LIBNAME_S=libtfm.a
|
||||
endif
|
||||
|
||||
default: $(LIBNAME)
|
||||
|
||||
$(OBJECTS): $(HEADERS)
|
||||
|
||||
.c.o:
|
||||
$(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
|
||||
|
||||
$(LIBNAME): $(OBJECTS)
|
||||
libtool --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION) -export-symbols libtfm.symbols
|
||||
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_LIB) -export-symbols libtfm.symbols
|
||||
|
||||
install: $(LIBNAME)
|
||||
install -d $(LIBPATH)
|
||||
libtool --mode=install install $(LIBNAME) $(LIBPATH)/$(LIBNAME)
|
||||
install -d $(INCPATH)
|
||||
install $(HEADERS_PUB) $(INCPATH)
|
||||
install: .common_install
|
||||
|
||||
HEADER_FILES=$(notdir $(HEADERS_PUB))
|
||||
uninstall:
|
||||
libtool --mode=uninstall rm $(LIBPATH)/$(LIBNAME)
|
||||
rm $(HEADER_FILES:%=$(INCPATH)/%)
|
||||
uninstall: .common_uninstall
|
||||
|
||||
mtest/mtest: mtest/mtest.c
|
||||
cd mtest ; make mtest
|
||||
|
110
makefile_include.mk
Normal file
110
makefile_include.mk
Normal file
@ -0,0 +1,110 @@
|
||||
#
|
||||
# Include makefile used by makefile + makefile.shared
|
||||
# (GNU make only)
|
||||
|
||||
ifndef INSTALL_CMD
|
||||
$(error your makefile must define INSTALL_CMD)
|
||||
endif
|
||||
ifndef UNINSTALL_CMD
|
||||
$(error your makefile must define UNINSTALL_CMD)
|
||||
endif
|
||||
|
||||
#
|
||||
# The Version of the library
|
||||
#
|
||||
VERSION=0.13.1-next
|
||||
VERSION_LIB=1:0:0
|
||||
|
||||
#
|
||||
# Compilation flags
|
||||
#
|
||||
# Note that we're extending the environments' CFLAGS.
|
||||
# If you think that our CFLAGS are not nice you can easily override them
|
||||
# by giving them as a parameter to make:
|
||||
# make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
|
||||
#
|
||||
CFLAGS += -Wall -W -Wshadow -Isrc/headers
|
||||
|
||||
ifdef COMPILE_DEBUG
|
||||
#debug
|
||||
CFLAGS += -g3
|
||||
else
|
||||
ifndef IGNORE_SPEED
|
||||
|
||||
CFLAGS += -O3 -funroll-loops
|
||||
|
||||
#profiling
|
||||
#PROF=-pg -g
|
||||
#CFLAGS += $(PROF)
|
||||
|
||||
#speed
|
||||
CFLAGS += -fomit-frame-pointer
|
||||
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# (Un)Install related variables
|
||||
#
|
||||
DESTDIR ?= /usr/local
|
||||
LIBPATH ?= $(DESTDIR)/lib
|
||||
INCPATH ?= $(DESTDIR)/include
|
||||
|
||||
|
||||
#
|
||||
# Build targets
|
||||
#
|
||||
|
||||
default: $(LIBNAME)
|
||||
|
||||
|
||||
.common_install: $(LIBNAME)
|
||||
install -d $(LIBPATH)
|
||||
$(INSTALL_CMD) $(LIBNAME) $(LIBPATH)/$(LIBNAME)
|
||||
install -d $(INCPATH)
|
||||
install $(HEADERS_PUB) $(INCPATH)
|
||||
|
||||
|
||||
HEADER_FILES=$(notdir $(HEADERS_PUB))
|
||||
.common_uninstall:
|
||||
$(UNINSTALL_CMD) $(LIBPATH)/$(LIBNAME)
|
||||
rm $(HEADER_FILES:%=$(INCPATH)/%)
|
||||
|
||||
|
||||
#This rule cleans the source tree of all compiled code, not including the pdf
|
||||
#documentation.
|
||||
clean:
|
||||
rm -f `find . -type f -name "*.o" | xargs`
|
||||
rm -f `find . -type f -name "*.lo" | xargs`
|
||||
rm -f `find . -type f -name "*.a" | xargs`
|
||||
rm -f `find . -type f -name "*.la" | xargs`
|
||||
rm -f `find . -type f -name "*.obj" | xargs`
|
||||
rm -f `find . -type f -name "*.lib" | xargs`
|
||||
rm -f `find . -type f -name "*.exe" | xargs`
|
||||
rm -f `find . -type f -name "*.gcov" | xargs`
|
||||
rm -f `find . -type f -name "*.gcda" | xargs`
|
||||
rm -f `find . -type f -name "*.gcno" | xargs`
|
||||
rm -f `find . -type f -name "*.il" | xargs`
|
||||
rm -f `find . -type f -name "*.dyn" | xargs`
|
||||
rm -f `find . -type f -name "*.dpi" | xargs`
|
||||
rm -rf `find . -type d -name "*.libs" | xargs`
|
||||
rm -f tfm.aux tfm.dvi tfm.idx tfm.ilg tfm.ind tfm.lof tfm.log tfm.out tfm.toc test test.exe
|
||||
cd mtest; MAKE=${MAKE} ${MAKE} clean
|
||||
|
||||
.PHONY: pre_gen
|
||||
pre_gen:
|
||||
perl gen.pl
|
||||
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
|
||||
rm mpi.c
|
||||
|
||||
zipup:
|
||||
rm -rf ../tomsfastmath-$(VERSION) && rm -f ../tfm-$(VERSION).zip ../tfm-$(VERSION).tar.bz2 && \
|
||||
expsrc.sh -i . -o ../tomsfastmath-$(VERSION) --svntags --no-fetch -p '*.c' -p '*.h' && \
|
||||
MAKE=${MAKE} ${MAKE} -C ../tomsfastmath-$(VERSION) docs && \
|
||||
tar -c ../tomsfastmath-$(VERSION)/* | xz -cz > ../tfm-$(VERSION).tar.xz && \
|
||||
find ../tomsfastmath-$(VERSION)/ -type f -exec unix2dos -q {} \; && \
|
||||
zip -9 -r ../tfm-$(VERSION).zip ../tomsfastmath-$(VERSION)/* && \
|
||||
gpg -b -a ../tfm-$(VERSION).tar.xz && gpg -b -a ../tfm-$(VERSION).zip
|
||||
|
||||
new_file:
|
||||
bash updatemakes.sh
|
Loading…
Reference in New Issue
Block a user