tomsfastmath/makefile

225 lines
6.9 KiB
Makefile
Raw Normal View History

2004-08-25 04:43:43 +02:00
#makefile for TomsFastMath
#
#
2015-11-07 16:28:23 +01:00
VERSION=0.14-develop
2005-08-01 18:37:35 +02:00
2007-03-14 18:58:46 +01:00
CFLAGS += -Wall -W -Wshadow -Isrc/headers
2005-08-01 18:37:35 +02:00
# Compiler and Linker Names
ifndef PREFIX
PREFIX=
endif
2014-10-13 13:39:30 +02:00
ifeq ($(CC),cc)
CC = $(PREFIX)gcc
endif
LD=$(PREFIX)ld
AR=$(PREFIX)ar
RANLIB=$(PREFIX)ranlib
2005-11-18 06:16:25 +01:00
ifndef MAKE
MAKE=make
endif
ifeq ($V,1)
silent=
else
silent=@
endif
%.o: %.c
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} ${CC} ${CFLAGS} -c $< -o $@
2016-04-24 18:39:35 +02:00
ifdef COMPILE_DEBUG
#debug
CFLAGS += -g3
else
2005-08-01 18:37:35 +02:00
ifndef IGNORE_SPEED
2006-04-06 21:49:03 +02:00
CFLAGS += -O3 -funroll-loops
2004-08-25 04:43:43 +02:00
#profiling
#PROF=-pg -g
#CFLAGS += $(PROF)
#speed
CFLAGS += -fomit-frame-pointer
2016-04-24 18:39:35 +02:00
endif
2005-08-01 18:37:35 +02:00
endif
2004-08-25 04:43:43 +02:00
2007-03-14 18:58:46 +01:00
#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 \
src/addsub/fp_submod.o src/addsub/s_fp_add.o src/addsub/s_fp_sub.o src/bin/fp_radix_size.o \
src/bin/fp_read_radix.o src/bin/fp_read_signed_bin.o src/bin/fp_read_unsigned_bin.o \
2014-06-12 18:16:06 +02:00
src/bin/fp_reverse.o src/bin/fp_signed_bin_size.o src/bin/fp_s_rmap.o src/bin/fp_toradix.o \
2015-02-15 23:30:09 +01:00
src/bin/fp_toradix_n.o src/bin/fp_to_signed_bin.o src/bin/fp_to_unsigned_bin.o \
src/bin/fp_unsigned_bin_size.o src/bit/fp_cnt_lsb.o src/bit/fp_count_bits.o src/bit/fp_div_2.o \
src/bit/fp_div_2d.o src/bit/fp_lshd.o src/bit/fp_mod_2d.o src/bit/fp_rshd.o src/divide/fp_div.o \
src/divide/fp_div_d.o src/divide/fp_mod.o src/divide/fp_mod_d.o src/exptmod/fp_2expt.o \
src/exptmod/fp_exptmod.o src/misc/fp_ident.o src/misc/fp_rand.o src/misc/fp_set.o \
src/mont/fp_montgomery_calc_normalization.o src/mont/fp_montgomery_reduce.o \
src/mont/fp_montgomery_setup.o src/mul/fp_mul_2.o src/mul/fp_mul_2d.o src/mul/fp_mul.o \
src/mul/fp_mul_comba_12.o src/mul/fp_mul_comba_17.o src/mul/fp_mul_comba_20.o src/mul/fp_mul_comba_24.o \
src/mul/fp_mul_comba_28.o src/mul/fp_mul_comba_32.o src/mul/fp_mul_comba_3.o src/mul/fp_mul_comba_48.o \
src/mul/fp_mul_comba_4.o src/mul/fp_mul_comba_64.o src/mul/fp_mul_comba_6.o src/mul/fp_mul_comba_7.o \
src/mul/fp_mul_comba_8.o src/mul/fp_mul_comba_9.o src/mul/fp_mul_comba.o \
2007-03-14 18:58:46 +01:00
src/mul/fp_mul_comba_small_set.o src/mul/fp_mul_d.o src/mul/fp_mulmod.o src/numtheory/fp_gcd.o \
2014-10-13 13:40:41 +02:00
src/numtheory/fp_invmod.o src/numtheory/fp_isprime.o src/numtheory/fp_isprime_ex.o \
src/numtheory/fp_lcm.o src/numtheory/fp_prime_miller_rabin.o src/numtheory/fp_prime_random_ex.o \
src/sqr/fp_sqr.o src/sqr/fp_sqr_comba_12.o src/sqr/fp_sqr_comba_17.o src/sqr/fp_sqr_comba_20.o \
src/sqr/fp_sqr_comba_24.o src/sqr/fp_sqr_comba_28.o src/sqr/fp_sqr_comba_32.o src/sqr/fp_sqr_comba_3.o \
src/sqr/fp_sqr_comba_48.o src/sqr/fp_sqr_comba_4.o src/sqr/fp_sqr_comba_64.o src/sqr/fp_sqr_comba_6.o \
src/sqr/fp_sqr_comba_7.o src/sqr/fp_sqr_comba_8.o src/sqr/fp_sqr_comba_9.o src/sqr/fp_sqr_comba.o \
src/sqr/fp_sqr_comba_generic.o src/sqr/fp_sqr_comba_small_set.o src/sqr/fp_sqrmod.o
2007-03-14 18:58:46 +01:00
HEADERS_PUB:=src/headers/tfm.h
HEADERS=src/headers/tfm_private.h $(HEADERS_PUB)
2007-03-14 18:58:46 +01:00
#END_INS
2005-07-23 12:43:03 +02:00
ifndef LIBPATH
LIBPATH=/usr/lib
endif
ifndef INCPATH
INCPATH=/usr/include
endif
2005-08-01 18:37:35 +02:00
ifndef INSTALL_GROUP
2005-07-23 12:43:03 +02:00
GROUP=wheel
2005-08-01 18:37:35 +02:00
else
GROUP=$(INSTALL_GROUP)
2005-07-23 12:43:03 +02:00
endif
2005-08-01 18:37:35 +02:00
ifndef INSTALL_USER
2005-07-23 12:43:03 +02:00
USER=root
2005-08-01 18:37:35 +02:00
else
USER=$(INSTALL_USER)
2005-07-23 12:43:03 +02:00
endif
ifndef LIBNAME
LIBNAME=libtfm.a
endif
2005-08-01 18:37:35 +02:00
default: $(LIBNAME)
$(OBJECTS): $(HEADERS)
2005-07-23 12:43:03 +02:00
$(LIBNAME): $(OBJECTS)
2005-08-01 18:37:35 +02:00
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
2005-07-23 12:43:03 +02:00
2005-08-01 18:37:35 +02:00
install: $(LIBNAME)
2005-07-23 12:43:03 +02:00
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)
2004-08-25 04:43:43 +02:00
2016-04-24 18:37:17 +02:00
HEADER_FILES=$(notdir $(HEADERS_PUB))
uninstall:
rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
rm $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)
2014-08-14 21:11:24 +02:00
.PHONY: mtest
mtest: $(LIBNAME)
cd mtest; CC="$(CC)" CFLAGS="$(CFLAGS) -I../" MAKE=${MAKE} ${MAKE} mtest
2004-08-25 04:43:43 +02:00
demo/test.o: CFLAGS+=-Wno-unused-result
2014-08-14 21:11:24 +02:00
.PHONY: test
test: $(LIBNAME) demo/test.o
2005-08-01 18:37:35 +02:00
$(CC) $(CFLAGS) demo/test.o $(LIBNAME) $(PROF) -o test
2004-08-25 04:43:43 +02:00
2015-02-15 15:13:20 +01:00
test_standalone: CFLAGS+=-DTFM_DEMO_TEST_VS_MTEST=0
.PHONY: test_standalone
test_standalone: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME) $(PROF) -o test
timing: $(LIBNAME) demo/timing.o
$(CC) $(CFLAGS) demo/timing.o $(LIBNAME) $(PROF) -o timing
2007-03-14 18:58:46 +01:00
profiled:
2014-08-14 21:11:24 +02:00
CC="$(CC)" PREFIX="${PREFIX} CFLAGS="${CFLAGS} -fprofile-generate" MAKE=${MAKE} ${MAKE} timing
2007-03-14 18:58:46 +01:00
./test
2014-08-14 21:11:24 +02:00
rm -f `find . -type f -name "*.o" | xargs`
rm -f `find . -type f -name "*.a" | xargs`
2007-03-14 18:58:46 +01:00
rm -f test
CC=$(CC) PREFIX="${PREFIX} CFLAGS="${CFLAGS} -fprofile-use" MAKE=${MAKE} ${MAKE} timing
2005-07-23 12:43:03 +02:00
2014-06-12 17:35:54 +02:00
stest: $(LIBNAME) demo/stest.o
2005-08-01 18:37:35 +02:00
$(CC) $(CFLAGS) demo/stest.o $(LIBNAME) -o stest
2005-07-23 12:43:03 +02:00
2005-08-01 18:37:35 +02:00
rsatest: $(LIBNAME) demo/rsa.o
$(CC) $(CFLAGS) demo/rsa.o $(LIBNAME) -o rsatest
2004-08-25 04:43:43 +02:00
docdvi: tfm.tex
2014-10-13 12:32:25 +02:00
cp tfm.tex tfm.bak
touch --reference=tfm.tex tfm.bak
(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y tfm.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > tfm-deterministic.tex
printf "%s\n" "\pdfinfo{" >> tfm-deterministic.tex
printf "%s\n" " /CreationDate (\fixedpdfdate)" >> tfm-deterministic.tex
printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> tfm-deterministic.tex
cat tfm.tex >> tfm-deterministic.tex
mv tfm-deterministic.tex tfm.tex
touch --reference=tfm.bak tfm.tex
2004-08-25 04:43:43 +02:00
touch tfm.ind
latex tfm >/dev/null
latex tfm >/dev/null
makeindex tfm
latex tfm >/dev/null
docs: docdvi
latex tfm >/dev/null
2014-10-13 12:32:25 +02:00
pdflatex tfm >/dev/null
sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' tfm.pdf
mv tfm.bak tfm.tex
2004-08-25 04:43:43 +02:00
mv -f tfm.pdf doc
2005-08-01 18:37:35 +02:00
#This rule cleans the source tree of all compiled code, not including the pdf
#documentation.
2004-08-25 04:43:43 +02:00
clean:
2014-08-14 21:11:24 +02:00
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`
2014-10-13 13:39:30 +02:00
rm -f tfm.aux tfm.dvi tfm.idx tfm.ilg tfm.ind tfm.lof tfm.log tfm.out tfm.toc test test.exe
2014-08-14 21:11:24 +02:00
cd mtest; MAKE=${MAKE} ${MAKE} clean
2004-08-25 04:43:43 +02:00
2015-08-06 19:54:38 +02:00
.PHONY: pre_gen
pre_gen:
perl gen.pl
2015-10-07 15:13:03 +02:00
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
rm mpi.c
2015-08-06 19:54:38 +02:00
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 && \
2015-11-07 16:29:29 +01:00
tar -c ../tomsfastmath-$(VERSION)/* | xz -cz > ../tfm-$(VERSION).tar.xz && \
find ../tomsfastmath-$(VERSION)/ -type f -exec unix2dos -q {} \; && \
2015-08-06 19:54:38 +02:00
zip -9 -r ../tfm-$(VERSION).zip ../tomsfastmath-$(VERSION)/* && \
2015-11-07 16:29:29 +01:00
gpg -b -a ../tfm-$(VERSION).tar.xz && gpg -b -a ../tfm-$(VERSION).zip
2005-08-01 18:37:35 +02:00
2015-02-15 23:28:36 +01:00
new_file:
bash updatemakes.sh
2014-06-12 17:35:54 +02:00
# $Source$
# $Revision$
# $Date$