cryptopals_c

cryptopals crypto challenges solutions in pure c
git clone git://git.superpozycja.net/cryptopals_c
Log | Files | Refs | README

makefile (813B)


      1 LIB_SRC=$(shell find lib -name '*.c')
      2 CHALLS_SRC=$(shell find src -name '*.c')
      3 LIB_OBJS=0xdeadbabe
      4 
      5 all: lib challs
      6 
      7 lib: $(LIB_SRC) dirs
      8 	$(foreach file,$(LIB_SRC),$(CC) -c -shared \
      9 	-o bin/lib/lib$(notdir $(subst .c,, $(file))).so $(file);)
     10 
     11 
     12 lib_objs: lib dirs
     13 	$(eval override LIB_OBJS=$(shell find bin/lib -name '*.so'))
     14 	find bin/lib -name '*.so'
     15 	echo $(LIB_OBJS)
     16 
     17 challs: $(CHALLS_SRC) dirs lib lib_objs
     18 	$(foreach file,$(CHALLS_SRC),\
     19 	$(CC) -o \
     20 	bin/$(subst src/,,$(basename $(file))) $(file) \
     21 	-Ilib/\
     22 	-Lbin/lib\
     23 	$(foreach lib_name,$(LIB_OBJS),\
     24 	-l$(subst lib,,$(subst .so,,$(notdir $(lib_name)))));)
     25 
     26 dirs:
     27 	mkdir -p bin
     28 	mkdir -p bin/lib
     29 	mkdir -p bin/s1
     30 	mkdir -p bin/s2
     31 	mkdir -p bin/s3
     32 	mkdir -p bin/s4
     33 	mkdir -p bin/s5
     34 	mkdir -p bin/s6
     35 	mkdir -p bin/s7
     36 	mkdir -p bin/s8
     37 
     38 clean:
     39 	rm -rf bin