xref: /freebsd/crypto/libecc/src/examples/hash/Makefile (revision f0865ec9906d5a18fa2a3b61381f22ce16e606ad)
1ROOT_DIR=../../..
2BUILD_DIR=$(ROOT_DIR)/build
3include $(ROOT_DIR)/common.mk
4
5# Remove old includes with bad relative folders
6CFLAGS := $(patsubst -I%,,$(CFLAGS))
7# Add proper includes
8CFLAGS += -I$(ROOT_DIR)/include/
9
10HASHES = gostr34_11_94.c md2.c md4.c md5.c mdc2.c sha0.c sha1.c tdes.c
11
12all:	libhash.a _hash
13ifeq ($(WITH_DYNAMIC_LIBS),1)
14# If the user asked for dynamic libraries, compile versions of our binaries against them
15all:	libhash.a _hash_dyn
16endif
17
18libhash.a: $(HASHES) hash.c
19	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(CC) $(LIB_CFLAGS) $(HASHES) hash.c -c
20	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(AR) $(AR_FLAGS) libhash.a *.o
21	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(RANLIB) $(RANLIB_FLAGS) libhash.a
22
23_hash:
24	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(CC) $(BIN_CFLAGS) -DHASH $(HASHES) hash.c $(ROOT_DIR)/src/external_deps/print.c $(ROOT_DIR)/src/external_deps/rand.c $(BIN_LDFLAGS) $(LIBSIGN) -o hash
25
26# If the user asked for dynamic libraries, compile versions of our binaries against them
27ifeq ($(WITH_DYNAMIC_LIBS),1)
28_hash_dyn: _libhash
29	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(CC) $(BIN_CFLAGS) -DHASH $(HASHES) hash.c $(ROOT_DIR)/src/external_deps/print.c $(ROOT_DIR)/src/external_deps/rand.c $(BIN_LDFLAGS) $(LIBEC) -L$(BUILD_DIR) -lsign -o hash_dyn
30endif
31
32
33clean:
34	@rm -f *.o libhash.a hash
35	@rm -f *.o libhash.a hash_dyn
36
37.PHONY: all clean 16 32 64 debug debug16 debug32 debug64 force_arch32 force_arch64
38