# Makefile for "Changing Base without Losing Space" (cbwls) # # Provides both the SOLE and LOSE encoding schemes as statically and dynamically # linkable libraries. VERSION = 0.1.0 all: # Include settings from configure script -include config.make prefix ?= $(HOME) bindir ?= $(prefix)/bin datarootdir ?= $(prefix)/share sysconfdir ?= $(prefix)/etc docdir ?= $(prefix)/doc mandir ?= $(prefix)/man SOLE_OBJS += src/sole.o SOLE_OBJS += src/blk128.o SOLE_OBJS += src/blk256.o EX_BLK256_OBJS = examples/blk256.o EX_SOLE_FILE = examples/sole_file.o bin/blk256: $(EX_BLK256_OBJS) bin/sole_file: $(EX_SOLE_FILE) libsole.a libnaive.a $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I./include -L. $^ -o $@ -lsole -lnaive EX_ENCODE_FILE = examples/encode_file.o bin/encode_file: $(EX_ENCODE_FILE) libsole.a libnaive.a libsolegmp.a $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I./include -L. $^ -o $@ -lsole -lnaive -lsolegmp -lgmp libsole.a: $(SOLE_OBJS) $(QUIET_AR)$(AR) rcs $@ $^ SOLE_GMP_OBJS = \ src/sole-gmp.o EX_SOLEG_FILE = examples/soleg.o libsolegmp.a: $(SOLE_GMP_OBJS) include/solegmp.h $(QUIET_AR)$(AR) rcs $@ $^ bin/soleg: $(EX_SOLEG_FILE) libsolegmp.a $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I./include -L. $^ -o $@ -lsolegmp -lgmp NAIVE_OBJS += naive/naive.o EX_NAIVE_FILE += examples/naive_file.o libnaive.a: $(NAIVE_OBJS) $(QUIET_AR)$(AR) rcs $@ $^ bin/naive_file: $(EX_NAIVE_FILE) libnaive.a $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I./include -L. $^ -o $@ -lnaive %: %.o $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $^ -o $@ %.o: %.c $(CONFIG_H) $(QUIET_CC)$(CC) -I./include $(CFLAGS) $(CPPFLAGS) -c -o $@ $< # Tests TEST_OBJS += t/all_tests.o TEST_OBJS += t/blk128_test.o TEST_OBJS += t/blk256_test.o TEST_OBJS += t/sole_test.o TEST_OBJS += t/seatest.o TEST_OBJS += src/blk256.o TEST_OBJS += src/blk128.o TEST_OBJS += src/sole.o bin/all_tests: $(TEST_OBJS) $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I./include $^ -o $@ test: bin/all_tests @bin/all_tests -v bin/div3: examples/div3.o libsole.a $(QUIET_LINK)$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -I./include -L. $^ -o $@ -lsole # Properly indent all source files in 'src', 'include' and 't' indent: find src t include -name '*c' -exec indent -linux {} \; clean: $(RM) $(SOLE_OBJS) \ examples/sole_file \ $(EX_SOLE_FILE) \ libsole.a \ $(TEST_OBJS) \ t/all_tests \ $(NAIVE_OBJS) \ libnaive.a \ $(SOLE_GMP_OBJS) \ $(EX_SOLEG_FILE) find -name '*~' -delete report: bench/myplot.m bench/save/run.sole.log bench/save/run.naive.log report/figs/avg-zero.ps bench/myplot3.m bench/save/run-sole-rand.log \ bench/save/run-naive-rand.log \ report/figs/run-sole-gmp-rand.log \ report/figs/avg-rand.ps cd report; $(MAKE) .PHONY: indent clean report # # Quiet make - code draws from tig/Makefile # ifneq ($(findstring $(MAKEFLAGS),s),s) V = @ Q = $(V:1=) QUIET_CC = $(Q:@=@echo ' CC '$@;) QUIET_AR = $(Q:@=@echo ' AR '$@;) QUIET_LINK = $(Q:@=@echo ' LINK '$@;) export V endif