OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / libdes / Makefile
1 include $(ROOTDIR)/freeswan/Makefile.inc
2
3
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.
12
13 # Targets
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
19 # make x86-solaris
20 # make x86-bdsi
21
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.
24
25 OPTS0= -DLIBDES_LIT -DRAND -DTERMIO #-DNOCONST
26
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
32
33 # There are 4 possible performance options
34 # -DDES_PTR
35 # -DDES_RISC1
36 # -DDES_RISC2 (only one of DES_RISC1 and DES_RISC2)
37 # -DDES_UNROLL
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
40 #OPTS2= -DDES_PTR 
41 #OPTS3= -DDES_RISC1 # or DES_RISC2
42 #OPTS4= -DDES_UNROLL
43
44 OPTS= $(OPTS0) $(OPTS1) $(OPTS2) $(OPTS3) $(OPTS4)
45
46 MAKE=make -f Makefile
47 #CC=cc
48 #CFLAG= -O
49
50 #CC=gcc
51 #CFLAG= -O4 -funroll-loops -fomit-frame-pointer
52 # normally overridden by FreeS/WAN Makefiles anyway
53 #CFLAG= -O3 -fomit-frame-pointer
54
55 EXTRA_CFLAGS += $(OPTS) $(CFLAG) # only ever add to CFLAGS
56 CPP=$(CC) -E
57 #AS=as
58
59 # Assember version of des_encrypt*().
60 DES_ENC=des_enc.o
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 
66 ifdef CONFIG_COLDFIRE
67  ifdef COLDFIRE_KERNEL
68   DES_ENC += asm/coldfire_des.o         # coldfire fast des
69   CPPFLAGS  += -DDES_ASM_FUNCTIONS=1
70  endif
71 endif
72 ifdef CONFIG_SUPERH
73   DES_ENC += asm/sh3.o
74   CPPFLAGS  += -DDES_ASM_FUNCTIONS=1
75 endif
76 ifdef CONFIG_X86
77   DES_ENC = asm/dx86-elf.o      # elf format x86
78   ifeq ($(CONFIG_HW_ASSIST),y)
79     DES_ENC += sw_des.o
80   else
81     DES_ENC += asm/yx86-elf.o   # elf format x86
82   endif
83 endif
84 ifeq ($(CONFIG_HW_ASSIST),y)
85   CPPFLAGS  += -DHW_ASSIST=1 -DNO_FCRYPT=1
86   DES_ENC   += 
87 else
88   DES_ENC += fcrypt_b.o
89   FCRYPT = fcrypt.o
90 endif
91
92 LIBDIR=${DESTDIR}/usr/local/lib
93 BINDIR=${DESTDIR}/usr/local/bin
94 INCDIR=${DESTDIR}/usr/local/include
95 MANDIR=${DESTDIR}/usr/local/man
96 MAN1=1
97 MAN3=3
98 SHELL=/bin/sh
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
105
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 \
111         des.org des_locl.org
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
124
125 PERL=   des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl
126
127 OBJ=    $(OBJ_LIT)
128 GENERAL=$(GENERAL_LIT)
129 TESTING=$(TESTING_LIT)
130 TESTING_SRC=$(TESTING_SRC_LIT)
131 HEADERS=$(HEADERS_LIT)
132 LIBDES= $(LIBDES_LIT)
133
134 ALL=    $(GENERAL) $(TESTING_SRC) $(LIBDES) $(PERL) $(HEADERS)
135
136 DLIB=   libdes.a
137
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
140
141 programs: $(DLIB)
142
143 all: $(DLIB) $(TESTING)
144
145 cc:
146         $(MAKE) CC=cc CFLAGS="-O $(OPTS) $(CFLAG)" all
147
148 gcc:
149         $(MAKE) CC=gcc CFLAGS="-O3 -fomit-frame-pointer $(OPTS) $(CFLAG)" all
150
151 x86-elf:
152         $(MAKE) DES_ENC='asm/dx86-elf.o asm/yx86-elf.o' CC='$(CC)' CFLAGS="-DELF $(OPTS) $(CFLAG)" all
153
154 x86-out:
155         $(MAKE) DES_ENC='asm/dx86-out.o asm/yx86-out.o' CC='$(CC)' CFLAGS="-DOUT $(OPTS) $(CFLAG)" all
156
157 x86-solaris:
158         $(MAKE) DES_ENC='asm/dx86-sol.o asm/yx86-sol.o' CC='$(CC)' CFLAGS="-DSOL $(OPTS) $(CFLAG)" all
159
160 x86-bsdi:
161         $(MAKE) DES_ENC='asm/dx86bsdi.o asm/yx86bsdi.o' CC='$(CC)' CFLAGS="-DBSDI $(OPTS) $(CFLAG)" all
162
163 # elf
164 asm/dx86-elf.o: asm/dx86unix.S
165         $(CPP) $(CPPFLAGS) -DELF $^ | $(AS) -o $@
166
167 asm/yx86-elf.o: asm/yx86unix.S
168         $(CPP) $(CPPFLAGS) -DELF $^ | $(AS) -o $@
169
170 # solaris
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
174         rm -f asm/dx86-sol.s
175
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
179         rm -f asm/yx86-sol.s
180
181 # a.out
182 asm/dx86-out.o: asm/dx86unix.S
183         $(CPP) -DOUT asm/dx86unix.S | $(AS) -o asm/dx86-out.o
184
185 asm/yx86-out.o: asm/yx86unix.S
186         $(CPP) -DOUT asm/yx86unix.S | $(AS) -o asm/yx86-out.o
187
188 # bsdi
189 asm/dx86bsdi.o: asm/dx86unix.S
190         $(CPP) -DBSDI asm/dx86unix.S | $(AS) -o asm/dx86bsdi.o
191
192 asm/yx86bsdi.o: asm/yx86unix.S
193         $(CPP) -DBSDI asm/yx86unix.S | $(AS) -o asm/yx86bsdi.o
194
195 asm/dx86unix.S: asm/des-586.pl
196         perl -I $(ROOTDIR)/freeswan/libdes/asm/perlasm -I $(ROOTDIR)/freeswan/libdes/asm $^ cpp >$@
197
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
201
202 .PHONY: asm
203 asm:
204         @[ -d asm ] || mkdir asm
205
206 .c.o:
207         $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
208
209 test:   all
210         ./destest
211
212 $(DLIB): asm $(OBJ)
213         /bin/rm -f $(DLIB)
214         $(AR) crs $(DLIB) $(OBJ)
215
216 des_opts: des_opts.o $(DLIB)
217         $(CC) $(CFLAGS) -o des_opts des_opts.o $(DLIB)
218
219 destest: destest.o $(DLIB)
220         $(CC) $(CFLAGS) -o destest destest.o $(DLIB)
221
222 rpw: rpw.o $(DLIB)
223         $(CC) $(CFLAGS) -o rpw rpw.o $(DLIB)
224
225 speed: speed.o $(DLIB)
226         $(CC) $(CFLAGS) -o speed speed.o $(DLIB)
227
228 des: des.o $(DLIB)
229         $(CC) $(CFLAGS) -o des des.o $(DLIB)
230
231 tags:
232         ctags $(TESTING_SRC) $(LIBDES)
233
234 tar_lit:
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)
239         /bin/rm -f Makefile
240         /bin/mv Makefile.tmp Makefile
241
242 tar:
243         tar chf libdes.tar $(ALL)
244
245 shar:
246         shar $(ALL) >libdes.shar
247
248 depend:
249         makedepend $(LIBDES) $(TESTING_SRC)
250
251 clean:
252         /bin/rm -f *.o tags core $(TESTING) $(DLIB) .nfs* *.old *.bak asm/*.o \
253                 asm/*.S
254
255 dclean:
256         sed -e '/^# DO NOT DELETE THIS LINE/ q' Makefile >Makefile.new
257         mv -f Makefile.new Makefile
258
259 # Eric is probably going to choke when he next looks at this --tjh
260 install:
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); \
266             else \
267                 if test -s /usr/bin/ranlib; then \
268                 /usr/bin/ranlib $(INSTALLTOP)/lib/$(DLIB); \
269             fi; fi; \
270             chmod 644 $(INSTALLTOP)/lib/$(DLIB); \
271             cp des.h $(INSTALLTOP)/include; \
272             chmod 644 $(INSTALLTOP)/include/des.h; \
273         else \
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); \
279             else \
280               if test -s /usr/bin/ranlib; then \
281                 /usr/bin/ranlib $(LIBDIR)/$(DLIB); \
282               fi; \
283             fi; \
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; \
291         fi
292
293 check:
294         echo no checks in lib right now.
295
296 checkprograms:
297
298 # DO NOT DELETE THIS LINE -- make depend depends on it.
299