2 # Include makefile used by makefile + makefile.shared
4 # SPDX-License-Identifier: Unlicense
7 $(error your makefile must
define INSTALL_CMD
)
10 $(error your makefile must
define UNINSTALL_CMD
)
14 # The Version of the library
20 GIT_VERSION
:= $(shell [ -e .git
] && { printf git-
; git describe
--tags --always
--dirty
; } || echo
$(VERSION
))
21 ifneq ($(GIT_VERSION
),)
22 CFLAGS
+= -DGIT_VERSION
=\"$(GIT_VERSION
)\"
25 # Compiler and Linker Names
31 CC
:= $(CROSS_COMPILE
)gcc
33 LD
:=$(CROSS_COMPILE
)ld
34 AR
:=$(CROSS_COMPILE
)ar
35 RANLIB
=$(CROSS_COMPILE
)ranlib
44 # Note that we're extending the environments' CFLAGS.
45 # If you think that our CFLAGS are not nice you can easily override them
46 # by giving them as a parameter to make:
47 # make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
50 CFLAGS
+= -Wall
-W
-Wshadow
-Isrc
/headers
60 PLATFORM
:= $(shell uname | sed
-e
's/_.*//')
61 ifneq ($(PLATFORM
), Darwin
)
62 CFLAGS
+= -funroll-loops
70 CFLAGS
+= -fomit-frame-pointer
76 # (Un)Install related variables
80 LIBPATH ?
= $(PREFIX
)/lib
81 INCPATH ?
= $(PREFIX
)/include
91 demo
/test.o
: CFLAGS
+=-Wno-unused-result
95 CC
="$(CC)" CFLAGS
="$(CFLAGS) -I../" MAKE
=${MAKE} ${MAKE} -C mtest
/ mtest
97 .common_install
: $(LIBNAME
)
98 install -d
$(DESTDIR
)$(LIBPATH
)
99 $(INSTALL_CMD
) $(LIBNAME
) $(DESTDIR
)$(LIBPATH
)/$(LIBNAME
)
100 install -d
$(DESTDIR
)$(INCPATH
)
101 install $(HEADERS_PUB
) $(DESTDIR
)$(INCPATH
)/tomsfastmath
104 HEADER_FILES
=$(notdir $(HEADERS_PUB
))
106 $(UNINSTALL_CMD
) $(DESTDIR
)$(LIBPATH
)/$(LIBNAME
)
107 rm $(HEADER_FILES
:%=$(DESTDIR
)$(INCPATH
)/%)
110 #This rule cleans the source tree of all compiled code, not including the pdf
113 find .
-type f
-name
"*.o" \
127 -o
-name
"*.dpi" | xargs
rm -f
128 find .
-type d
-name
"*.libs" | xargs
rm -rf
129 rm -f tfm.aux tfm.
dvi tfm.idx tfm.ilg tfm.ind tfm.lof tfm.log tfm.out tfm.toc
test test.exe
130 cd mtest
; MAKE
=${MAKE} ${MAKE} clean
133 $(MAKE
) -C doc
/ $@ V
=$(V
)
136 $(MAKE
) -C doc
/ tfm.pdf V
=$(V
)
139 SOURCES
= $(OBJECTS
:.o
=.c
)
140 pre_gen
/tfm_amalgam.c
: $(SOURCES
)
143 /* TomsFastMath, a fast ISO C bignum library. -- Tom St Denis */\n\
144 /* SPDX-License-Identifier: Unlicense */\n\
146 /*** AUTO-GENERATED FILE! DO NOT EDIT MANUALLY ***/\n\
148 #define TFM_PRE_GEN_MPI_C\n\
152 amalgam pre_gen
: pre_gen
/tfm_amalgam.c
155 @
# Update the index, so diff-index won't fail in case the pdf has been created.
156 @
# As the pdf creation modifies tfm.tex, git sometimes detects the
157 @
# modified file, but misses that it's put back to its original version.
158 @git update-index
--refresh
159 @git diff-index
--quiet HEAD
-- ||
( echo
"FAILURE: uncommited changes or not a git" && exit
1 )
160 rm -rf tomsfastmath-
$(VERSION
) tfm-
$(VERSION
).
*
161 @
# files/dirs excluded from "git archive" are defined in .gitattributes
162 git archive
--format
=tar --prefix=tomsfastmath-
$(VERSION
)/ HEAD |
tar x
163 mkdir
-p tomsfastmath-
$(VERSION
)/doc
164 cp doc
/tfm.pdf tomsfastmath-
$(VERSION
)/doc
/tfm.pdf
165 $(MAKE
) -C tomsfastmath-
$(VERSION
)/ pre_gen
166 tar -c tomsfastmath-
$(VERSION
)/ | xz
-6e
-c
- > tfm-
$(VERSION
).
tar.xz
167 zip
-9rq tfm-
$(VERSION
).zip tomsfastmath-
$(VERSION
)
168 rm -rf tomsfastmath-
$(VERSION
)
169 gpg
-b
-a tfm-
$(VERSION
).
tar.xz
170 gpg
-b
-a tfm-
$(VERSION
).zip