e68d846429
This closes #232
75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
# MAKEFILE for linux GCC
|
|
#
|
|
# This makefile produces a shared object and requires libtool to be installed.
|
|
#
|
|
# Thanks to Zed Shaw for helping debug this on BSD/OSX.
|
|
# Tom St Denis
|
|
#
|
|
# (GNU make only)
|
|
|
|
### USAGE:
|
|
#
|
|
# CFLAGS="-DUSE_LTM -DLTM_DESC -I/path/to/libtommath" make -f makefile.shared all EXTRALIBS=/path/to/libtommath/libtommath.a
|
|
# ./test
|
|
# make -f makefile.shared PREFIX=/opt/libtom install
|
|
#
|
|
|
|
PLATFORM := $(shell uname | sed -e 's/_.*//')
|
|
|
|
ifndef LT
|
|
ifeq ($(PLATFORM), Darwin)
|
|
LT:=glibtool
|
|
else
|
|
LT:=libtool
|
|
endif
|
|
endif
|
|
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
|
|
INSTALL_CMD = $(LT) --mode=install install
|
|
|
|
#Output filenames for various targets.
|
|
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
|
|
|
|
.c.o:
|
|
$(LTCOMPILE) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -c $<
|
|
|
|
$(LIBNAME): $(OBJECTS)
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) `find ./src -type f -name "*.lo" | LC_ALL=C sort` $(EXTRALIBS) -o $@ -rpath $(LIBPATH) -version-info $(VERSION_LT)
|
|
|
|
install: .common_install
|
|
sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > libtomcrypt.pc
|
|
install -d $(DESTDIR)$(LIBPATH)/pkgconfig
|
|
install -m 644 libtomcrypt.pc $(DESTDIR)$(LIBPATH)/pkgconfig/
|
|
|
|
install_bins: .common_install_bins
|
|
|
|
test: $(LIBNAME) $(TOBJECTS)
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TEST) $(TOBJECTS) $(LIBNAME) $(EXTRALIBS)
|
|
|
|
timing: $(TIMINGS) $(LIBNAME)
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(TIMING) $^ $(EXTRALIBS)
|
|
|
|
# build the demos from a template
|
|
define DEMO_template
|
|
$(1): demos/$(1).o $$(LIBNAME)
|
|
ifneq ($V,1)
|
|
@echo " * $${CC} $$@"
|
|
endif
|
|
$$(LT) --mode=link --tag=CC $$(CC) $$(CFLAGS) $$(CPPFLAGS) $$(LDFLAGS) $$^ $$(EXTRALIBS) -o $(1)
|
|
endef
|
|
|
|
$(foreach demo, $(strip $(DEMOS)), $(eval $(call DEMO_template,$(demo))))
|
|
|
|
# ref: $Format:%D$
|
|
# git commit: $Format:%H$
|
|
# commit time: $Format:%ai$
|