1 # MAKEFILE for linux GCC
4 # Modified by Clay Culver
9 silent_echo
= > /dev
/null
19 silent_stdout
= > /dev
/null
20 silent_stderr
= 2> /dev
/null
23 PLATFORM
:= $(shell uname | sed
-e
's/_.*//')
27 RANLIB
:=$(CROSS_COMPILE
)ranlib
32 #Output filenames for various targets.
38 include makefile_include.mk
41 all_test
: LIB_PRE
= -Wl
,--whole-archive
42 all_test
: LIB_POST
= -Wl
,--no-whole-archive
43 LTC_CFLAGS
+= -fprofile-arcs
-ftest-coverage
44 LTC_EXTRALIBS
+= -lgcov
47 LTC_EXTRALIBS
+= $(EXTRALIBS
)
49 #AES comes in two flavours... enc+dec and enc
50 src
/ciphers
/aes
/aes_enc.o
: src
/ciphers
/aes
/aes.c src
/ciphers
/aes
/aes_tab.c
52 @echo
" * ${CC} $@" ${silent_echo}
54 ${silent} ${CC} ${LTC_CFLAGS} -DENCRYPT_ONLY
-c
$< -o
$@
55 src
/ciphers
/aes
/aes_enc_desc.o
: src
/ciphers
/aes
/aes_desc.c
57 @echo
" * ${CC} $@" ${silent_echo}
59 ${silent} ${CC} ${LTC_CFLAGS} -DENCRYPT_ONLY
-c
$< -o
$@
63 @echo
" * ${CC} $@" ${silent_echo}
65 ${silent} ${CC} ${LTC_CFLAGS} -c
$< -o
$@
67 $(LIBNAME
): $(OBJECTS
)
69 @echo
" * ${AR} $@" ${silent_echo}
71 ${silent} $(AR
) $(ARFLAGS
) $@
$(OBJECTS
)
73 @echo
" * ${RANLIB} $@" ${silent_echo}
75 ${silent} $(RANLIB
) $@
77 test: $(call print-help
,test,Builds the library and the
'test' application to run
all self-tests
) $(LIBNAME
) $(TOBJECTS
)
79 @echo
" * ${CC} $@" ${silent_echo}
81 ${silent} $(CC
) $(LTC_LDFLAGS
) $(TOBJECTS
) $(LIB_PRE
) $(LIBNAME
) $(LIB_POST
) $(LTC_EXTRALIBS
) -o
$(TEST
)
83 # build the demos from a template
85 $(1): $(call print-help
,$(1),Builds the library and the
'$(1)' demo
) demos
/$(1).o
$$(LIBNAME
)
87 @echo
" * $${CC} $$@" ${silent_echo}
89 $${silent} $$(CC
) $$(LTC_LDFLAGS
) $$< $$(LIB_PRE
) $$(LIBNAME
) $$(LIB_POST
) $$(LTC_EXTRALIBS
) -o
$$@
92 $(foreach demo
, $(strip $(DEMOS
)), $(eval
$(call DEMO_template
,$(demo
))))
95 #This rule installs the library and the header files. This must be run
96 #as root in order to have a high enough permission to write to the correct
97 #directories and to set the owner and group to root.
98 install: $(call print-help
,install,Installs the library and headers
) .common_install
100 install_bins
: $(call print-help
,install_bins
,Installs the useful demos
($(USEFUL_DEMOS
))) .common_install_bins
102 uninstall: $(call print-help
,uninstall,Uninstalls the library and headers
) .common_uninstall
105 LTC_CFLAGS
="$(LTC_CFLAGS) -fprofile-generate" $(MAKE
) timing EXTRALIBS
="$(LTC_EXTRALIBS) -lgcov"
107 rm -f timing
`find . -type f | grep [.][ao] | xargs`
108 LTC_CFLAGS
="$(LTC_CFLAGS) -fprofile-use" $(MAKE
) timing EXTRALIBS
="$(LTC_EXTRALIBS) -lgcov"
110 # target that pre-processes all coverage data
112 lcov
--capture
--no-external
--directory src
-q
--output-file coverage_std.
info
114 # target that removes all coverage output
116 rm -f
`find . -type f -name "*.info" | xargs`
119 # merges all coverage_*.info files into coverage.info
121 lcov
`find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.
info
123 # generates html output from all coverage_*.info files
124 lcov-html
: coverage.
info
125 genhtml coverage.
info --output-directory coverage
-q
127 # combines all necessary steps to create the coverage from a single testrun with e.g.
128 # CFLAGS="-DUSE_LTM -DLTM_DESC -I../libtommath" EXTRALIBS="../libtommath/libtommath.a" make coverage -j9
130 $(MAKE
) cleancov-clean
131 $(MAKE
) lcov-single-create
132 $(MAKE
) coverage.
info
135 #make the code coverage of the library
136 coverage
: LTC_CFLAGS
+= -fprofile-arcs
-ftest-coverage
137 coverage
: LTC_EXTRALIBS
+= -lgcov
138 coverage
: LIB_PRE
= -Wl
,--whole-archive
139 coverage
: LIB_POST
= -Wl
,--no-whole-archive
141 coverage
: $(call print-help
,coverage
,Create code-coverage of the library
- but better use coverage.sh
) test
144 # cleans everything - coverage output and standard 'clean'
145 cleancov
: cleancov-clean
clean