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
)
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
)
141 sed
-e
's/[[:blank:]]*$$//' mpi.c
> pre_gen
/mpi.c
145 @
# Update the index, so diff-index won't fail in case the pdf has been created.
146 @
# As the pdf creation modifies tfm.tex, git sometimes detects the
147 @
# modified file, but misses that it's put back to its original version.
148 @git update-index
--refresh
149 @git diff-index
--quiet HEAD
-- ||
( echo
"FAILURE: uncommited changes or not a git" && exit
1 )
150 rm -rf tomsfastmath-
$(VERSION
) tfm-
$(VERSION
).
*
151 @
# files/dirs excluded from "git archive" are defined in .gitattributes
152 git archive
--format
=tar --prefix=tomsfastmath-
$(VERSION
)/ HEAD |
tar x
153 mkdir
-p tomsfastmath-
$(VERSION
)/doc
154 cp doc
/tfm.pdf tomsfastmath-
$(VERSION
)/doc
/tfm.pdf
155 $(MAKE
) -C tomsfastmath-
$(VERSION
)/ pre_gen
156 tar -c tomsfastmath-
$(VERSION
)/ | xz
-6e
-c
- > tfm-
$(VERSION
).
tar.xz
157 zip
-9rq tfm-
$(VERSION
).zip tomsfastmath-
$(VERSION
)
158 rm -rf tomsfastmath-
$(VERSION
)
159 gpg
-b
-a tfm-
$(VERSION
).
tar.xz
160 gpg
-b
-a tfm-
$(VERSION
).zip
165 .PHONY
: pre_gen doc
/tfm.pdf