2 # make - twidle the options yourself :-)
3 # make cc - standard cc options
4 # make gcc - standard gcc options
5 # make x86-elf - linux-elf etc
6 # make x86-out - linux-a.out, FreeBSD etc
10 # use BF_PTR2 for intel boxes,
11 # BF_PTR for sparc and MIPS/SGI
12 # use nothing for Alpha and HP.
14 # There are 3 possible performance options, experiment :-)
15 #OPTS= -DBF_PTR # usr for sparc and MIPS/SGI
16 #OPTS= -DBF_PTR2 # use for pentium
17 OPTS= # use for pentium pro, Alpha and HP
24 #CFLAG= -O4 -funroll-loops -fomit-frame-pointer
25 CFLAG= -O3 -fomit-frame-pointer
27 CFLAGS=$(OPTS) $(CFLAG)
31 # Assember version of bf_encrypt().
32 BF_ENC=bf_enc.o # normal C version
33 #BF_ENC=asm/bx86-elf.o # elf format x86
34 #BF_ENC=asm/bx86-out.o # a.out format x86
35 #BF_ENC=asm/bx86-sol.o # solaris format x86
36 #BF_ENC=asm/bx86bsdi.o # bsdi format x86
40 INCDIR=/usr/local/include
45 LIBOBJ=bf_skey.o bf_ecb.o $(BF_ENC) bf_cbc.o bf_cfb64.o bf_ofb64.o
46 LIBSRC=bf_skey.c bf_ecb.c bf_enc.c bf_cbc.c bf_cfb64.c bf_ofb64.c
48 GENERAL=Makefile Makefile.ssl Makefile.uni asm bf_locl.org README \
49 COPYRIGHT blowfish.doc INSTALL
51 TESTING= bftest bfspeed
52 TESTING_SRC=bftest.c bfspeed.c
53 HEADERS=bf_locl.h blowfish.h bf_pi.h
55 ALL= $(GENERAL) $(TESTING_SRC) $(LIBSRC) $(HEADERS)
59 all: $(BLIB) $(TESTING)
62 $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
65 $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
68 $(MAKE) BF_ENC='asm/bx86-elf.o' CC=$(CC) CFLAGS="-DELF $(OPTS) $(CFLAG)" all
71 $(MAKE) BF_ENC='asm/bx86-out.o' CC=$(CC) CFLAGS="-DOUT $(OPTS) $(CFLAG)" all
74 $(MAKE) BF_ENC='asm/bx86-sol.o' CC=$(CC) CFLAGS="-DSOL $(OPTS) $(CFLAG)" all
77 $(MAKE) BF_ENC='asm/bx86bsdi.o' CC=$(CC) CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all
80 asm/bx86-elf.o: asm/bx86-cpp.s asm/bx86unix.cpp
81 $(CPP) -DELF asm/bx86unix.cpp | $(AS) -o asm/bx86-elf.o
84 asm/bx86-sol.o: asm/bx86-cpp.s asm/bx86unix.cpp
85 $(CC) -E -DSOL asm/bx86unix.cpp | sed 's/^#.*//' > asm/bx86-sol.s
86 as -o asm/bx86-sol.o asm/bx86-sol.s
90 asm/bx86-out.o: asm/bx86-cpp.s asm/bx86unix.cpp
91 $(CPP) -DOUT asm/bx86unix.cpp | $(AS) -o asm/bx86-out.o
94 asm/bx86bsdi.o: asm/bx86-cpp.s asm/bx86unix.cpp
95 $(CPP) -DBSDI asm/bx86unix.cpp | $(AS) -o asm/bx86bsdi.o
102 ar cr $(BLIB) $(LIBOBJ)
103 -if test -s /bin/ranlib; then /bin/ranlib $(BLIB); \
104 else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $(BLIB); \
107 bftest: bftest.o $(BLIB)
108 $(CC) $(CFLAGS) -o bftest bftest.o $(BLIB)
110 bfspeed: bfspeed.o $(BLIB)
111 $(CC) $(CFLAGS) -o bfspeed bfspeed.o $(BLIB)
114 ctags $(TESTING_SRC) $(LIBBF)
117 tar chf libbf.tar $(ALL)
120 shar $(ALL) >libbf.shar
123 makedepend $(LIBBF) $(TESTING_SRC)
126 /bin/rm -f *.o tags core $(TESTING) $(BLIB) .nfs* *.old *.bak asm/*.o
129 sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
130 mv -f Makefile.new Makefile
132 # Eric is probably going to choke when he next looks at this --tjh
134 if test $(INSTALLTOP); then \
135 echo SSL style install; \
136 cp $(BLIB) $(INSTALLTOP)/lib; \
137 if test -s /bin/ranlib; then \
138 /bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
140 if test -s /usr/bin/ranlib; then \
141 /usr/bin/ranlib $(INSTALLTOP)/lib/$(BLIB); \
143 chmod 644 $(INSTALLTOP)/lib/$(BLIB); \
144 cp blowfish.h $(INSTALLTOP)/include; \
145 chmod 644 $(INSTALLTOP)/include/blowfish.h; \
147 echo Standalone install; \
148 cp $(BLIB) $(LIBDIR)/$(BLIB); \
149 if test -s /bin/ranlib; then \
150 /bin/ranlib $(LIBDIR)/$(BLIB); \
152 if test -s /usr/bin/ranlib; then \
153 /usr/bin/ranlib $(LIBDIR)/$(BLIB); \
156 chmod 644 $(LIBDIR)/$(BLIB); \
157 cp blowfish.h $(INCDIR)/blowfish.h; \
158 chmod 644 $(INCDIR)/blowfish.h; \
160 # DO NOT DELETE THIS LINE -- make depend depends on it.