소스 검색

merge .include and .common makefiles

Steffen Jaeckel 8 년 전
부모
커밋
7379c94f0a
5개의 변경된 파일103개의 추가작업 그리고 99개의 파일을 삭제
  1. 1 1
      helper.pl
  2. 6 5
      makefile
  3. 0 85
      makefile.common
  4. 6 6
      makefile.shared
  5. 90 2
      makefile_include.mk

+ 1 - 1
helper.pl

@@ -260,7 +260,7 @@ sub process_makefiles {
   }
   }
 
 
   # update OBJECTS + HEADERS in makefile*
   # 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 $old = read_file($m);
     my $new = $m eq 'makefile.msvc' ? patch_makefile($old, $var_obj, $var_h, $var_tobj, @ver_version)
     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);
                                     : patch_makefile($old, $var_o, $var_h, $var_to, @ver_version);

+ 6 - 5
makefile

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

+ 0 - 85
makefile.common

@@ -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

+ 6 - 6
makefile.shared

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

+ 90 - 2
makefile.include → makefile_include.mk

@@ -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
 # The version - BEWARE: VERSION and VERSION_LT are updated via ./updatemakes.sh
 VERSION=1.17
 VERSION=1.17
@@ -313,3 +313,91 @@ library: $(LIBNAME)
 $(OBJECTS): $(HEADERS)
 $(OBJECTS): $(HEADERS)
 $(DOBJECTS): $(HEADERS) $(THEADERS)
 $(DOBJECTS): $(HEADERS) $(THEADERS)
 $(TOBJECTS): $(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