merge .include and .common makefiles

This commit is contained in:
Steffen Jaeckel 2017-05-10 11:56:52 +02:00
parent 2c27aee5d4
commit 7379c94f0a
5 changed files with 103 additions and 99 deletions

View File

@ -260,7 +260,7 @@ sub process_makefiles {
}
# update OBJECTS + HEADERS in makefile*
for my $m (qw/ makefile makefile.shared makefile.unix makefile.mingw makefile.msvc makefile.include /) {
for my $m (qw/ makefile makefile.shared makefile.unix makefile.mingw makefile.msvc makefile_include.mk /) {
my $old = read_file($m);
my $new = $m eq 'makefile.msvc' ? patch_makefile($old, $var_obj, $var_h, $var_tobj, @ver_version)
: patch_makefile($old, $var_o, $var_h, $var_to, @ver_version);

View File

@ -2,8 +2,8 @@
#
# Tom St Denis
# Modified by Clay Culver
include makefile.include
#
# (GNU make only)
ifeq ($V,1)
silent=
@ -23,7 +23,6 @@ endif
endif
INSTALL_CMD = install
#Output filenames for various targets.
ifndef LIBNAME
LIBNAME=libtomcrypt.a
@ -32,6 +31,10 @@ ifndef LIBTEST
LIBTEST=libtomcrypt_prof.a
endif
include makefile_include.mk
#AES comes in two flavours... enc+dec and enc
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
${silent} ${CC} ${CFLAGS} -DENCRYPT_ONLY -c $< -o $@
@ -136,6 +139,4 @@ coverage: test
# cleans everything - coverage output and standard 'clean'
cleancov: cleancov-clean clean
include makefile.common
# git commit: $Format:%h$ $Format:%ai$

View File

@ -1,85 +0,0 @@
#common make targets shared over multiple makefiles
ifndef INSTALL_CMD
$(error your makefile must define INSTALL_CMD)
endif
bins: $(USEFUL_DEMOS)
all_test: test tv_gen $(DEMOS)
#build the doxy files (requires Doxygen, tetex and patience)
doxygen doxy docs:
$(MAKE) -C doc/ $@ V=$(V)
doc/crypt.pdf:
$(MAKE) -C doc/ crypt.pdf V=$(V)
install_all: install install_bins install_docs install_test
.common_install: $(LIBNAME)
install -d $(INCPATH)
install -d $(LIBPATH)
$(INSTALL_CMD) -m 644 $(LIBNAME) $(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS) $(INCPATH)
.common_install_bins: $(USEFUL_DEMOS)
install -d $(BINPATH)
$(INSTALL_CMD) -m 775 $(USEFUL_DEMOS) $(BINPATH)
.common_install_test: $(LIBTEST)
install -d $(LIBPATH)
install -d $(INCPATH)
install -m 644 testprof/tomcrypt_test.h $(INCPATH)
$(INSTALL_CMD) -m 644 $(LIBTEST) $(LIBPATH)
install_docs: doc/crypt.pdf
install -d $(DATAPATH)
install -m 644 doc/crypt.pdf $(DATAPATH)
install_hooks:
for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
#This rule cleans the source tree of all compiled code, not including the pdf
#documentation.
clean:
find . -type f -name "*.o" \
-o -name "*.lo" \
-o -name "*.a" \
-o -name "*.la" \
-o -name "*.obj" \
-o -name "*.lib" \
-o -name "*.exe" \
-o -name "*.dll" \
-o -name "*.so" \
-o -name "*.gcov"\
-o -name "*.gcda"\
-o -name "*.gcno"\
-o -name "*.il" \
-o -name "*.dyn" \
-o -name "*.dpi" | xargs rm -f
rm -f $(TIMING) $(TEST) $(DEMOS)
rm -f *_tv.txt
rm -f *.pc
rm -rf `find . -type d -name "*.libs" | xargs`
$(MAKE) -C doc/ clean
zipup: docs
@git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
@perl helper.pl --check-all || ( echo "FAILURE: helper.pl --check-all errors" && exit 1 )
rm -rf libtomcrypt-$(VERSION) libtomcrypt-$(VERSION).*
# files/dirs excluded from "git archive" are defined in .gitattributes
git archive --format=tar --prefix=libtomcrypt-$(VERSION)/ HEAD | tar x
mkdir -p libtomcrypt-$(VERSION)/doc
cp doc/crypt.pdf libtomcrypt-$(VERSION)/doc/crypt.pdf
tar -cJf libtomcrypt-$(VERSION).tar.xz libtomcrypt-$(VERSION)
zip -9rq libtomcrypt-$(VERSION).zip libtomcrypt-$(VERSION)
rm -rf libtomcrypt-$(VERSION)
gpg -b -a libtomcrypt-$(VERSION).tar.xz
gpg -b -a libtomcrypt-$(VERSION).zip
codecheck:
perl helper.pl -a
perlcritic *.pl

View File

@ -4,9 +4,8 @@
#
# Thanks to Zed Shaw for helping debug this on BSD/OSX.
# Tom St Denis
include makefile.include
#
# (GNU make only)
ifndef LT
ifeq ($(PLATFORM), Darwin)
@ -18,7 +17,6 @@ endif
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
INSTALL_CMD = $(LT) --mode=install install
#Output filenames for various targets.
ifndef LIBTEST
LIBTEST=libtomcrypt_prof.la
@ -27,6 +25,10 @@ ifndef LIBNAME
LIBNAME=libtomcrypt.la
endif
include makefile_include.mk
#ciphers come in two flavours... enc+dec and enc
src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
$(LTCOMPILE) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
@ -66,8 +68,6 @@ endef
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
include makefile.common
# $Source$
# $Revision$
# $Date$

View File

@ -1,6 +1,6 @@
#
# Include makefile for libtomcrypt
#
# Include makefile used by makefile + makefile.shared
# (GNU make only)
# The version - BEWARE: VERSION and VERSION_LT are updated via ./updatemakes.sh
VERSION=1.17
@ -313,3 +313,91 @@ library: $(LIBNAME)
$(OBJECTS): $(HEADERS)
$(DOBJECTS): $(HEADERS) $(THEADERS)
$(TOBJECTS): $(HEADERS) $(THEADERS)
ifndef INSTALL_CMD
$(error your makefile must define INSTALL_CMD)
endif
ifndef EXTRALIBS
EXTRALIBS=$(shell PKG_CONFIG_PATH=$(LIBPATH)/pkgconfig pkg-config libtommath --libs)
endif
bins: $(USEFUL_DEMOS)
all_test: test tv_gen $(DEMOS)
#build the doxy files (requires Doxygen, tetex and patience)
doxygen doxy docs:
$(MAKE) -C doc/ $@ V=$(V)
doc/crypt.pdf:
$(MAKE) -C doc/ crypt.pdf V=$(V)
install_all: install install_bins install_docs install_test
.common_install: $(LIBNAME)
install -d $(INCPATH)
install -d $(LIBPATH)
$(INSTALL_CMD) -m 644 $(LIBNAME) $(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS) $(INCPATH)
.common_install_bins: $(USEFUL_DEMOS)
install -d $(BINPATH)
$(INSTALL_CMD) -m 775 $(USEFUL_DEMOS) $(BINPATH)
.common_install_test: $(LIBTEST)
install -d $(LIBPATH)
install -d $(INCPATH)
install -m 644 testprof/tomcrypt_test.h $(INCPATH)
$(INSTALL_CMD) -m 644 $(LIBTEST) $(LIBPATH)
install_docs: doc/crypt.pdf
install -d $(DATAPATH)
install -m 644 doc/crypt.pdf $(DATAPATH)
install_hooks:
for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
#This rule cleans the source tree of all compiled code, not including the pdf
#documentation.
clean:
find . -type f -name "*.o" \
-o -name "*.lo" \
-o -name "*.a" \
-o -name "*.la" \
-o -name "*.obj" \
-o -name "*.lib" \
-o -name "*.exe" \
-o -name "*.dll" \
-o -name "*.so" \
-o -name "*.gcov"\
-o -name "*.gcda"\
-o -name "*.gcno"\
-o -name "*.il" \
-o -name "*.dyn" \
-o -name "*.dpi" | xargs rm -f
rm -f $(TIMING) $(TEST) $(DEMOS)
rm -f *_tv.txt
rm -f *.pc
rm -rf `find . -type d -name "*.libs" | xargs`
$(MAKE) -C doc/ clean
zipup: docs
@git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
@perl helper.pl --check-all || ( echo "FAILURE: helper.pl --check-all errors" && exit 1 )
rm -rf libtomcrypt-$(VERSION) libtomcrypt-$(VERSION).*
# files/dirs excluded from "git archive" are defined in .gitattributes
git archive --format=tar --prefix=libtomcrypt-$(VERSION)/ HEAD | tar x
mkdir -p libtomcrypt-$(VERSION)/doc
cp doc/crypt.pdf libtomcrypt-$(VERSION)/doc/crypt.pdf
tar -cJf libtomcrypt-$(VERSION).tar.xz libtomcrypt-$(VERSION)
zip -9rq libtomcrypt-$(VERSION).zip libtomcrypt-$(VERSION)
rm -rf libtomcrypt-$(VERSION)
gpg -b -a libtomcrypt-$(VERSION).tar.xz
gpg -b -a libtomcrypt-$(VERSION).zip
codecheck:
perl helper.pl -a
perlcritic *.pl