xref: /freebsd/crypto/libecc/src/examples/sss/Makefile (revision dd21556857e8d40f66bf5ad54754d9d52669ebf7)
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
10KEEP_SYMBOLS=--keep-global-symbol=sss_generate --keep-global-symbol=sss_combine --keep-global-symbol=sss_regenerate
11
12all:	sss
13ifeq ($(WITH_DYNAMIC_LIBS),1)
14# If the user asked for dynamic libraries, compile versions of our binaries against them
15all:	sss_dyn
16endif
17
18sss:
19	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(CC) $(BIN_CFLAGS) -DSSS sss.c $(ROOT_DIR)/src/external_deps/print.c $(ROOT_DIR)/src/external_deps/rand.c $(BIN_LDFLAGS) $(LIBSIGN) -o sss
20
21sss_lib:
22	# Compile libsss archive
23	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(CC) $(LIB_CFLAGS) -c sss.c $(ROOT_DIR)/src/external_deps/print.c $(ROOT_DIR)/src/external_deps/rand.c
24	$(VERBOSE_MAKE)cp $(LIBSIGN) ./
25	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(AR) xv libsign.a
26	# Make unnecessary symbols local
27	$(VERBOSE_MAKE)for f in `ls *.o`; do objcopy $(KEEP_SYMBOLS) $$f && echo "Processing $$f"; done
28	# Combine the archives
29	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(AR) $(AR_FLAGS) libsss.a *.o
30	@rm -f *.o libsign.a
31
32# If the user asked for dynamic libraries, compile versions of our binaries against them
33ifeq ($(WITH_DYNAMIC_LIBS),1)
34sss_dyn:
35	$(VERBOSE_MAKE)$(CROSS_COMPILE)$(CC) $(BIN_CFLAGS) -DSSS sss.c $(ROOT_DIR)/src/external_deps/print.c $(ROOT_DIR)/src/external_deps/rand.c $(BIN_LDFLAGS) $(LIBSIGN) -L$(BUILD_DIR) -lsign -o sss_dyn
36endif
37
38
39clean:
40	@rm -f *.o
41	@rm -f sss
42	@rm -f sss_dyn
43
44.PHONY: all clean 16 32 64 debug debug16 debug32 debug64 force_arch32 force_arch64
45