tomcrypt/makefile

143 lines
3.5 KiB
Makefile
Raw Normal View History

2003-03-02 19:59:24 -05:00
# MAKEFILE for linux GCC
#
# Tom St Denis
# Modified by Clay Culver
2017-05-10 05:56:52 -04:00
#
# (GNU make only)
ifeq ($V,1)
silent=
silent_stdout=
else
silent=@
silent_stdout= > /dev/null
endif
2005-11-18 00:15:37 -05:00
# ranlib tools
ifndef RANLIB
2007-07-20 13:48:02 -04:00
ifeq ($(PLATFORM), Darwin)
RANLIB:=$(PREFIX)ranlib -c
2007-07-20 13:48:02 -04:00
else
RANLIB:=$(PREFIX)ranlib
2007-07-20 13:48:02 -04:00
endif
2005-11-18 00:15:37 -05:00
endif
INSTALL_CMD = install
2003-03-02 19:59:24 -05:00
#Output filenames for various targets.
2005-08-01 12:36:47 -04:00
ifndef LIBNAME
LIBNAME=libtomcrypt.a
endif
ifndef LIBTEST
LIBTEST=libtomcrypt_prof.a
endif
2017-05-10 05:56:52 -04:00
include makefile_include.mk
#AES comes in two flavours... enc+dec and enc
2004-12-30 18:55:53 -05:00
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
${silent} ${CC} ${CFLAGS} -DENCRYPT_ONLY -c $< -o $@
2004-06-19 22:41:49 -04:00
.c.o:
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} ${CC} ${CFLAGS} -c $< -o $@
2003-09-07 21:06:11 -04:00
$(LIBNAME): $(OBJECTS)
2016-01-18 18:38:05 -05:00
ifneq ($V,1)
@echo " * ${AR} $@"
endif
${silent} $(AR) $(ARFLAGS) $@ $(OBJECTS)
ifneq ($V,1)
@echo " * ${RANLIB} $@"
endif
${silent} $(RANLIB) $@
2003-03-02 19:59:24 -05:00
2017-05-02 14:47:00 -04:00
$(LIBTEST): $(TOBJECTS)
ifneq ($V,1)
@echo " * ${AR} $@"
endif
${silent} $(AR) $(ARFLAGS) $@ $(TOBJECTS)
ifneq ($V,1)
@echo " * ${RANLIB} $@"
endif
${silent} $(RANLIB) $@
2016-01-23 13:00:23 -05:00
2017-05-07 17:01:27 -04:00
timing: $(LIBNAME) $(LIBTEST) $(TIMINGS)
2016-01-23 13:00:23 -05:00
ifneq ($V,1)
@echo " * ${CC} $@"
endif
2017-05-02 14:47:00 -04:00
${silent} $(CC) $(LDFLAGS) $(TIMINGS) $(LIBTEST) $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TIMING)
2016-01-23 13:00:23 -05:00
2017-05-07 17:01:27 -04:00
test: $(LIBNAME) $(LIBTEST) $(TESTS)
2016-01-23 13:00:23 -05:00
ifneq ($V,1)
@echo " * ${CC} $@"
endif
2017-05-02 14:47:00 -04:00
${silent} $(CC) $(LDFLAGS) $(TESTS) $(LIBTEST) $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TEST)
2016-01-23 13:00:23 -05:00
2016-01-23 12:59:30 -05:00
# build the demos from a template
define DEMO_template
2017-05-07 17:01:27 -04:00
$(1): demos/$(1).o $$(LIBNAME)
2016-01-23 12:59:30 -05:00
ifneq ($V,1)
@echo " * $${CC} $$@"
endif
2017-04-18 10:05:11 -04:00
$${silent} $$(CC) $$(CFLAGS) $$< $$(LIB_PRE) $$(LIBNAME) $$(LIB_POST) $$(EXTRALIBS) -o $(1)
2016-01-23 12:59:30 -05:00
endef
2003-03-02 19:59:24 -05:00
2016-01-23 12:59:30 -05:00
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
2005-04-17 07:37:13 -04:00
2016-04-03 11:45:16 -04:00
ifeq ($(COVERAGE),1)
all_test: LIB_PRE = -Wl,--whole-archive
all_test: LIB_POST = -Wl,--no-whole-archive
endif
2003-03-02 19:59:24 -05:00
#This rule installs the library and the header files. This must be run
#as root in order to have a high enough permission to write to the correct
#directories and to set the owner and group to root.
install: .common_install
2003-03-02 19:59:24 -05:00
install_bins: .common_install_bins
install_test: .common_install_test
2005-06-08 20:08:13 -04:00
profile:
2005-11-18 00:15:37 -05:00
CFLAGS="$(CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
2005-06-08 20:08:13 -04:00
./timing
rm -f timing `find . -type f | grep [.][ao] | xargs`
2005-11-18 00:15:37 -05:00
CFLAGS="$(CFLAGS) -fprofile-use" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
2005-06-08 20:08:13 -04:00
# target that pre-processes all coverage data
lcov-single-create:
lcov --capture --no-external --directory src -q --output-file coverage_std.info
# target that removes all coverage output
cleancov-clean:
rm -f `find . -type f -name "*.info" | xargs`
rm -rf coverage/
# generates html output from all coverage_*.info files
lcov:
lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info -q 2>/dev/null
genhtml coverage.info --output-directory coverage -q
2004-10-29 23:00:26 -04:00
# combines all necessary steps to create the coverage from a single testrun with e.g.
# CFLAGS="-DUSE_LTM -DLTM_DESC -I../libtommath" EXTRALIBS="../libtommath/libtommath.a" make coverage -j9
lcov-single: | cleancov-clean lcov-single-create lcov
2016-04-03 11:45:16 -04:00
#make the code coverage of the library
coverage: CFLAGS += -fprofile-arcs -ftest-coverage
coverage: EXTRALIBS += -lgcov
2016-04-03 11:45:16 -04:00
coverage: LIB_PRE = -Wl,--whole-archive
coverage: LIB_POST = -Wl,--no-whole-archive
coverage: test
./test
# cleans everything - coverage output and standard 'clean'
cleancov: cleancov-clean clean
2017-05-05 03:28:05 -04:00
# git commit: $Format:%h$ $Format:%ai$