1 include $(ROOTDIR)/freeswan/Makefile.inc
4 # You must select the correct terminal control system to be used to
5 # turn character echo off when reading passwords. There a 5 systems
6 # SGTTY - the old BSD system
7 # TERMIO - most system V boxes
8 # TERMIOS - SGI (ala IRIX).
9 # VMS - the DEC operating system
10 # MSDOS - we all know what it is :-)
11 # read_pwd.c makes a reasonable guess at what is correct.
14 # make - twidle the options yourself :-)
15 # make cc - standard cc options
16 # make gcc - standard gcc options
17 # make x86-elf - linux-elf etc
18 # make x86-out - linux-a.out, FreeBSD etc
22 # If you are on a DEC Alpha, edit des.h and change the DES_LONG
23 # define to 'unsigned int'. I have seen this give a %20 speedup.
25 OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST
27 # Version 1.94 has changed the strings_to_key function so that it is
28 # now compatible with MITs when the string is longer than 8 characters.
29 # If you wish to keep the old version, uncomment the following line.
30 # This will affect the -E/-D options on des(1).
31 #OPTS1= -DOLD_STR_TO_KEY
33 # There are 4 possible performance options
36 # -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2)
38 # after the initial build, run 'des_opts' to see which options are best
39 # for your platform. There are some listed in options.txt
41 #OPTS3= -DDES_RISC1 # or DES_RISC2
44 OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4)
51 #CFLAG= -O4 -funroll-loops -fomit-frame-pointer
52 # normally overridden by FreeS/WAN Makefiles anyway
53 #CFLAG= -O3 -fomit-frame-pointer
55 EXTRA_CFLAGS += $(OPTS) $(CFLAG) # only ever add to CFLAGS
59 # Assember version of des_encrypt*().
61 #DES_ENC=des_enc.o fcrypt_b.o # normal C version
62 #DES_ENC=asm/dx86-elf.o asm/yx86-elf.o # elf format x86
63 #DES_ENC=asm/dx86-out.o asm/yx86-out.o # a.out format x86
64 #DES_ENC=asm/dx86-sol.o asm/yx86-sol.o # solaris format x86
65 #DES_ENC=asm/dx86bsdi.o asm/yx86basi.o # bsdi format x86
68 DES_ENC += asm/coldfire_des.o # coldfire fast des
69 CPPFLAGS += -DDES_ASM_FUNCTIONS=1
74 CPPFLAGS += -DDES_ASM_FUNCTIONS=1
77 DES_ENC = asm/dx86-elf.o # elf format x86
78 ifeq ($(CONFIG_HW_ASSIST),y)
81 DES_ENC += asm/yx86-elf.o # elf format x86
84 ifeq ($(CONFIG_HW_ASSIST),y)
85 CPPFLAGS += -DHW_ASSIST=1 -DNO_FCRYPT=1
92 LIBDIR=${DESTDIR}/usr/local/lib
93 BINDIR=${DESTDIR}/usr/local/bin
94 INCDIR=${DESTDIR}/usr/local/include
95 MANDIR=${DESTDIR}/usr/local/man
99 OBJ_LIT=cbc_enc.o ecb_enc.o $(DES_ENC) $(FCRYPT) set_key.o
100 OBJ_FULL=cbc_cksm.o $(OBJ_LIT) pcbc_enc.o \
101 xcbc_enc.o qud_cksm.o \
102 cfb64ede.o cfb64enc.o cfb_enc.o ecb3_enc.o \
103 enc_read.o enc_writ.o ofb64ede.o ofb64enc.o ofb_enc.o \
104 rand_key.o read_pwd.o read2pwd.o rpc_enc.o str2key.o supp.o
106 GENERAL_LIT=COPYRIGHT INSTALL README VERSION Makefile des_crypt.man \
107 des.doc options.txt asm
108 GENERAL_FULL=$(GENERAL_LIT) FILES Imakefile times vms.com KERBEROS MODES.DES \
109 des.man DES.pm DES.pod DES.xs Makefile.PL dess.S des3s.S \
110 Makefile.uni typemap t Makefile.ssl makefile.bc Makefile.lit \
112 TESTING_LIT= destest speed des_opts
113 TESTING_FULL= rpw $(TESTING_LIT)
114 TESTING_SRC_LIT=destest.c speed.c des_opts.c
115 TESTING_SRC_FULL=rpw.c $(TESTING_SRC_LIT)
116 HEADERS_LIT=des_ver.h des.h des_locl.h podd.h sk.h spr.h
117 HEADERS_FULL= $(HEADERS_LIT) rpc_des.h
118 LIBDES_LIT=cbc_enc.c ecb_enc.c fcrypt.c set_key.c des_enc.c fcrypt_b.c
119 LIBDES_FULL= cbc_cksm.c pcbc_enc.c qud_cksm.c \
120 cfb64ede.c cfb64enc.c cfb_enc.c ecb3_enc.c \
121 enc_read.c enc_writ.c ofb64ede.c ofb64enc.c ofb_enc.c \
122 rand_key.c rpc_enc.c str2key.c supp.c \
123 xcbc_enc.c $(LIBDES_LIT) read_pwd.c read2pwd.c
125 PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl
128 GENERAL=$(GENERAL_LIT)
129 TESTING=$(TESTING_LIT)
130 TESTING_SRC=$(TESTING_SRC_LIT)
131 HEADERS=$(HEADERS_LIT)
132 LIBDES= $(LIBDES_LIT)
134 ALL= $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS)
138 .PHONY: all cc gcc x86-elf x86-out x86-solaris x86-bsdi test tar_lit \
139 tar shar depend clean dclean install check checkprograms
143 all: $(DLIB) $(TESTING)
146 $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
149 $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
152 $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC='$(CC)' CFLAGS="-DELF $(OPTS) $(CFLAG)" all
155 $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC='$(CC)' CFLAGS="-DOUT $(OPTS) $(CFLAG)" all
158 $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC='$(CC)' CFLAGS="-DSOL $(OPTS) $(CFLAG)" all
161 $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC='$(CC)' CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all
164 asm/dx86-elf.o: asm/dx86unix.S
165 $(CPP) $(CPPFLAGS) -DELF $^ | $(AS) -o $@
167 asm/yx86-elf.o: asm/yx86unix.S
168 $(CPP) $(CPPFLAGS) -DELF $^ | $(AS) -o $@
171 asm/dx86-sol.o: asm/dx86unix.S
172 $(CC) -E -DSOL asm/dx86unix.S | sed 's/^#.*//' > asm/dx86-sol.s
173 as -o asm/dx86-sol.o asm/dx86-sol.s
176 asm/yx86-sol.o: asm/yx86unix.S
177 $(CC) -E -DSOL asm/yx86unix.S | sed 's/^#.*//' > asm/yx86-sol.s
178 as -o asm/yx86-sol.o asm/yx86-sol.s
182 asm/dx86-out.o: asm/dx86unix.S
183 $(CPP) -DOUT asm/dx86unix.S | $(AS) -o asm/dx86-out.o
185 asm/yx86-out.o: asm/yx86unix.S
186 $(CPP) -DOUT asm/yx86unix.S | $(AS) -o asm/yx86-out.o
189 asm/dx86bsdi.o: asm/dx86unix.S
190 $(CPP) -DBSDI asm/dx86unix.S | $(AS) -o asm/dx86bsdi.o
192 asm/yx86bsdi.o: asm/yx86unix.S
193 $(CPP) -DBSDI asm/yx86unix.S | $(AS) -o asm/yx86bsdi.o
195 asm/dx86unix.S: asm/des-586.pl
196 perl -I $(ROOTDIR)/freeswan/libdes/asm/perlasm -I $(ROOTDIR)/freeswan/libdes/asm $^ cpp >$@
198 asm/yx86unix.S: asm/des-586.pl
199 perl -I $(ROOTDIR)/freeswan/libdes/asm/perlasm -I $(ROOTDIR)/freeswan/libdes/asm $^ cpp >$@
200 (cd $(ROOTDIR)/freeswan/libdes/asm; perl crypt586.pl cpp ) > asm/yx86unix.S
204 @[ -d asm ] || mkdir asm
207 $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
214 $(AR) crs $(DLIB) $(OBJ)
216 des_opts: des_opts.o $(DLIB)
217 $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB)
219 destest: destest.o $(DLIB)
220 $(CC) $(CFLAGS) -o destest destest.o $(DLIB)
223 $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB)
225 speed: speed.o $(DLIB)
226 $(CC) $(CFLAGS) -o speed speed.o $(DLIB)
229 $(CC) $(CFLAGS) -o des des.o $(DLIB)
232 ctags $(TESTING_SRC) $(LIBDES)
235 /bin/mv Makefile Makefile.tmp
236 /bin/cp Makefile.lit Makefile
237 tar chf libdes-l.tar $(LIBDES_LIT) $(HEADERS_LIT) \
238 $(GENERAL_LIT) $(TESTING_SRC_LIT)
240 /bin/mv Makefile.tmp Makefile
243 tar chf libdes.tar $(ALL)
246 shar $(ALL) >libdes.shar
249 makedepend $(LIBDES) $(TESTING_SRC)
252 /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o \
256 sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
257 mv -f Makefile.new Makefile
259 # Eric is probably going to choke when he next looks at this --tjh
261 if test $(INSTALLTOP); then \
262 echo SSL style install; \
263 cp $(DLIB) $(INSTALLTOP)/lib; \
264 if test -s /bin/ranlib; then \
265 /bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \
267 if test -s /usr/bin/ranlib; then \
268 /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \
270 chmod 644 $(INSTALLTOP)/lib/$(DLIB); \
271 cp des.h $(INSTALLTOP)/include; \
272 chmod 644 $(INSTALLTOP)/include/des.h; \
274 echo Standalone install; \
275 mkdir -p ${LIBDIR}; \
276 cp $(DLIB) $(LIBDIR)/$(DLIB); \
277 if test -s /bin/ranlib; then \
278 /bin/ranlib $(LIBDIR)/$(DLIB); \
280 if test -s /usr/bin/ranlib; then \
281 /usr/bin/ranlib $(LIBDIR)/$(DLIB); \
284 chmod 644 $(LIBDIR)/$(DLIB); \
285 mkdir -p ${MANDIR}/man${MAN3}; \
286 cp des_crypt.man $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \
287 chmod 644 $(MANDIR)/man$(MAN3)/des_crypt.$(MAN3); \
288 mkdir -p ${INCDIR}; \
289 cp des.h $(INCDIR)/des.h; \
290 chmod 644 $(INCDIR)/des.h; \
294 echo no checks in lib right now.
298 # DO NOT DELETE THIS LINE -- make depend depends on it.