| 
									
										
										
										
											2003-03-03 00:59:24 +00:00
										 |  |  | # MAKEFILE for linux GCC
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Tom St Denis
 | 
					
						
							|  |  |  | # Modified by Clay Culver
 | 
					
						
							| 
									
										
										
										
											2017-05-10 11:56:52 +02:00
										 |  |  | #
 | 
					
						
							|  |  |  | #  (GNU make only)
 | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-05 14:30:15 +01:00
										 |  |  | ifeq ($V,1) | 
					
						
							|  |  |  | silent= | 
					
						
							| 
									
										
										
										
											2017-02-28 13:26:12 +01:00
										 |  |  | silent_stdout= | 
					
						
							| 
									
										
										
										
											2015-12-05 14:30:15 +01:00
										 |  |  | else | 
					
						
							|  |  |  | silent=@ | 
					
						
							| 
									
										
										
										
											2017-02-28 13:26:12 +01:00
										 |  |  | silent_stdout= > /dev/null | 
					
						
							| 
									
										
										
										
											2015-12-05 14:30:15 +01:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-11-18 05:15:37 +00:00
										 |  |  | # ranlib tools
 | 
					
						
							|  |  |  | ifndef RANLIB | 
					
						
							| 
									
										
										
										
											2007-07-20 17:48:02 +00:00
										 |  |  | ifeq ($(PLATFORM), Darwin) | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | RANLIB:=$(PREFIX)ranlib -c | 
					
						
							| 
									
										
										
										
											2007-07-20 17:48:02 +00:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2015-01-13 22:41:27 +01:00
										 |  |  | RANLIB:=$(PREFIX)ranlib | 
					
						
							| 
									
										
										
										
											2007-07-20 17:48:02 +00:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2005-11-18 05:15:37 +00:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2017-05-09 00:07:22 +02:00
										 |  |  | INSTALL_CMD = install | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-03 00:59:24 +00:00
										 |  |  | #Output filenames for various targets.
 | 
					
						
							| 
									
										
										
										
											2005-08-01 16:36:47 +00:00
										 |  |  | ifndef LIBNAME | 
					
						
							|  |  |  |    LIBNAME=libtomcrypt.a | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 11:56:52 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | include makefile_include.mk | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-11 15:53:22 +02:00
										 |  |  | ifeq ($(COVERAGE),1) | 
					
						
							|  |  |  | all_test: LIB_PRE = -Wl,--whole-archive | 
					
						
							|  |  |  | all_test: LIB_POST = -Wl,--no-whole-archive | 
					
						
							|  |  |  | CFLAGS += -fprofile-arcs -ftest-coverage | 
					
						
							|  |  |  | EXTRALIBS += -lgcov | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2017-05-10 11:56:52 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-05 14:30:15 +01:00
										 |  |  | #AES comes in two flavours... enc+dec and enc
 | 
					
						
							| 
									
										
										
										
											2004-12-30 23:55:53 +00:00
										 |  |  | src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c | 
					
						
							| 
									
										
										
										
											2015-12-05 14:30:15 +01:00
										 |  |  | 	${silent} ${CC} ${CFLAGS} -DENCRYPT_ONLY -c $< -o $@ | 
					
						
							| 
									
										
										
										
											2004-06-20 02:41:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-05 19:11:16 +02:00
										 |  |  | .c.o: | 
					
						
							|  |  |  | ifneq ($V,1) | 
					
						
							|  |  |  | 	@echo "   * ${CC} $@" | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 	${silent} ${CC} ${CFLAGS} -c $< -o $@ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-09-08 01:06:11 +00:00
										 |  |  | $(LIBNAME): $(OBJECTS) | 
					
						
							| 
									
										
										
										
											2016-01-19 00:38:05 +01:00
										 |  |  | ifneq ($V,1) | 
					
						
							|  |  |  | 	@echo "   * ${AR} $@" | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 	${silent} $(AR) $(ARFLAGS) $@ $(OBJECTS) | 
					
						
							|  |  |  | ifneq ($V,1) | 
					
						
							|  |  |  | 	@echo "   * ${RANLIB} $@" | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 	${silent} $(RANLIB) $@ | 
					
						
							| 
									
										
										
										
											2003-03-03 00:59:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-05 15:58:10 +02:00
										 |  |  | timing: $(LIBNAME) $(TIMINGS) tests/common.o | 
					
						
							| 
									
										
										
										
											2016-01-23 19:00:23 +01:00
										 |  |  | ifneq ($V,1) | 
					
						
							|  |  |  | 	@echo "   * ${CC} $@" | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2017-06-05 15:58:10 +02:00
										 |  |  | 	${silent} $(CC) $(LDFLAGS) $(TIMINGS) tests/common.o $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TIMING) | 
					
						
							| 
									
										
										
										
											2016-01-23 19:00:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-05 15:51:29 +02:00
										 |  |  | test: $(LIBNAME) $(TOBJECTS) | 
					
						
							| 
									
										
										
										
											2016-01-23 19:00:23 +01:00
										 |  |  | ifneq ($V,1) | 
					
						
							|  |  |  | 	@echo "   * ${CC} $@" | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2017-06-05 15:51:29 +02:00
										 |  |  | 	${silent} $(CC) $(LDFLAGS) $(TOBJECTS) $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(EXTRALIBS) -o $(TEST) | 
					
						
							| 
									
										
										
										
											2016-01-23 19:00:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-23 18:59:30 +01:00
										 |  |  | # build the demos from a template
 | 
					
						
							|  |  |  | define DEMO_template | 
					
						
							| 
									
										
										
										
											2017-06-05 15:58:10 +02:00
										 |  |  | $(1): demos/$(1).o $$(LIBNAME) tests/common.o | 
					
						
							| 
									
										
										
										
											2016-01-23 18:59:30 +01:00
										 |  |  | ifneq ($V,1) | 
					
						
							|  |  |  | 	@echo "   * $${CC} $$@" | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2017-06-05 15:58:10 +02:00
										 |  |  | 	$${silent} $$(CC) $$(CFLAGS) $$< tests/common.o $$(LIB_PRE) $$(LIBNAME) $$(LIB_POST) $$(EXTRALIBS) -o $(1) | 
					
						
							| 
									
										
										
										
											2016-01-23 18:59:30 +01:00
										 |  |  | endef | 
					
						
							| 
									
										
										
										
											2003-03-03 00:59:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-23 18:59:30 +01:00
										 |  |  | $(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo)))) | 
					
						
							| 
									
										
										
										
											2005-04-17 11:37:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-06 15:46:01 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-03 00:59:24 +00: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.
 | 
					
						
							| 
									
										
										
										
											2017-05-09 00:07:22 +02:00
										 |  |  | install: .common_install | 
					
						
							| 
									
										
										
										
											2003-03-03 00:59:24 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-09 00:07:22 +02:00
										 |  |  | install_bins: .common_install_bins | 
					
						
							| 
									
										
										
										
											2017-05-07 22:30:59 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-06-09 00:08:13 +00:00
										 |  |  | profile: | 
					
						
							| 
									
										
										
										
											2005-11-18 05:15:37 +00:00
										 |  |  | 	CFLAGS="$(CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov" | 
					
						
							| 
									
										
										
										
											2005-06-09 00:08:13 +00:00
										 |  |  | 	./timing | 
					
						
							|  |  |  | 	rm -f timing `find . -type f | grep [.][ao] | xargs` | 
					
						
							| 
									
										
										
										
											2005-11-18 05:15:37 +00:00
										 |  |  | 	CFLAGS="$(CFLAGS) -fprofile-use" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov" | 
					
						
							| 
									
										
										
										
											2005-06-09 00:08:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-08 02:11:43 +02: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/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-11 15:53:22 +02:00
										 |  |  | # merges all coverage_*.info files into coverage.info
 | 
					
						
							|  |  |  | coverage.info: | 
					
						
							|  |  |  | 	lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-08 02:11:43 +02:00
										 |  |  | # generates html output from all coverage_*.info files
 | 
					
						
							| 
									
										
										
										
											2017-05-11 15:53:22 +02:00
										 |  |  | lcov-html: coverage.info | 
					
						
							| 
									
										
										
										
											2015-08-30 17:17:05 +02:00
										 |  |  | 	genhtml coverage.info --output-directory coverage -q | 
					
						
							| 
									
										
										
										
											2004-10-30 03:00:26 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-08 02:11:43 +02: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
 | 
					
						
							| 
									
										
										
										
											2017-05-11 15:53:22 +02:00
										 |  |  | lcov-single: | 
					
						
							|  |  |  | 	$(MAKE) cleancov-clean | 
					
						
							|  |  |  | 	$(MAKE) lcov-single-create | 
					
						
							|  |  |  | 	$(MAKE) coverage.info | 
					
						
							| 
									
										
										
										
											2015-09-08 02:11:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-03 17:45:16 +02:00
										 |  |  | #make the code coverage of the library
 | 
					
						
							| 
									
										
										
										
											2015-09-08 02:11:43 +02:00
										 |  |  | coverage: CFLAGS += -fprofile-arcs -ftest-coverage | 
					
						
							|  |  |  | coverage: EXTRALIBS += -lgcov | 
					
						
							| 
									
										
										
										
											2016-04-03 17:45:16 +02:00
										 |  |  | coverage: LIB_PRE = -Wl,--whole-archive | 
					
						
							|  |  |  | coverage: LIB_POST = -Wl,--no-whole-archive | 
					
						
							| 
									
										
										
										
											2015-09-08 02:11:43 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | coverage: test | 
					
						
							|  |  |  | 	./test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # cleans everything - coverage output and standard 'clean'
 | 
					
						
							|  |  |  | cleancov: cleancov-clean clean | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-10 13:54:05 +02:00
										 |  |  | # ref:         $Format:%D$
 | 
					
						
							|  |  |  | # git commit:  $Format:%H$
 | 
					
						
							|  |  |  | # commit time: $Format:%ai$
 |