Ensure that no-comp functions are flagged as such
[openssl.git] / Makefile.in
1 ##
2 ## Makefile for OpenSSL
3 ##
4 ## {- join("\n## ", @autowarntext) -}
5
6 VERSION={- $config{version} -}
7 MAJOR={- $config{major} -}
8 MINOR={- $config{minor} -}
9 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
10 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
11 SHLIB_MAJOR={- $config{shlib_major} -}
12 SHLIB_MINOR={- $config{shlib_minor} -}
13 SHLIB_EXT={- $target{shared_extension} || ".so" -}
14 SHLIB_EXT_SIMPLE={- $target{shared_extension_simple} || ".so" -}
15 SHLIB_EXT_IMPORT={- $target{shared_import_extension} || "" -}
16 DSO_EXT={- $target{dso_extension} || ".so" -}
17 PLATFORM={- $config{target} -}
18 OPTIONS={- $config{options} -}
19 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
20 SHLIB_TARGET={- $target{shared_target} -}
21
22 # HERE indicates where this Makefile lives.  This can be used to indicate
23 # where sub-Makefiles are expected to be.  Currently has very limited usage,
24 # and should probably not be bothered with at all.
25 HERE=.
26
27 # DESTDIR is for package builders so that they can configure
28 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
29 # Normally it is left empty.
30 DESTDIR=
31
32 # Do not edit these manually. Use Configure with --prefix or --openssldir
33 # to change this!  Short explanation in the top comment in Configure
34 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
35               #
36               our $prefix = $config{prefix} || "/usr/local";
37               $prefix -}
38 OPENSSLDIR={- #
39               # The logic here is that if no --openssldir was given,
40               # OPENSSLDIR will get the value from $prefix plus "/ssl".
41               # If --openssldir was given and the value is an absolute
42               # path, OPENSSLDIR will get its value without change.
43               # If the value from --openssldir is a relative path,
44               # OPENSSLDIR will get $prefix with the --openssldir
45               # value appended as a subdirectory.
46               #
47               use File::Spec::Functions;
48               our $openssldir =
49                   $config{openssldir} ?
50                       (file_name_is_absolute($config{openssldir}) ?
51                            $config{openssldir}
52                            : catdir($prefix, $config{openssldir}))
53                       : catdir($prefix, "ssl");
54               $openssldir -}
55 LIBDIR={- #
56           # if $prefix/lib$target{multilib} is not an existing
57           # directory, then assume that it's not searched by linker
58           # automatically, in which case adding $target{multilib} suffix
59           # causes more grief than we're ready to tolerate, so don't...
60           our $multilib =
61               -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
62           our $libdir = $config{libdir} || "lib$multilib";
63           $libdir -}
64 ENGINESDIR={- use File::Spec::Functions;
65               catdir($prefix,$libdir,"engines") -}
66
67 # NO_IDEA - Define to build without the IDEA algorithm
68 # NO_RC4  - Define to build without the RC4 algorithm
69 # NO_RC2  - Define to build without the RC2 algorithm
70 # THREADS - Define when building with threads, you will probably also need any
71 #           system defines as well, i.e. _REENTRANT for Solaris 2.[34]
72 # TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
73 # TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
74 # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
75 # DEVRANDOM - Give this the value of the 'random device' if your OS supports
76 #           one.  32 bytes will be read from this when the random
77 #           number generator is initalised.
78 # SSL_FORBID_ENULL - define if you want the server to be not able to use the
79 #           NULL encryption ciphers.
80 #
81 # LOCK_DEBUG - turns on lots of lock debug output :-)
82 # REF_DEBUG - turn on some xyz_free() assertions.
83 # REF_PRINT - prints some stuff on structure free.
84 # MFUNC - Make all Malloc/Free/Realloc calls call
85 #       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
86 #       call application defined callbacks via CRYPTO_set_mem_functions()
87 # MD5_ASM needs to be defined to use the x86 assembler for MD5
88 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1
89 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
90 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
91 # equal 4.
92 # PKCS1_CHECK - pkcs1 tests.
93
94 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
95 CC= $(CROSS_COMPILE){- $target{cc} -}
96 CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
97 CFLAG_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
98 LDFLAG= {- $target{lflags} -} {- $config{lflags} -}
99 PLIB_LDFLAG= {- $target{plib_lflags} -} {- $config{plib_lflags} -}
100 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
101 EXE_EXT= {- $target{exe_extension} -}
102 ARFLAGS= {- $target{arflags} -}
103 AR=$(CROSS_COMPILE){- $target{ar} -} $(ARFLAGS) r
104 RANLIB= {- $target{ranlib} -}
105 NM= $(CROSS_COMPILE){- $target{nm} -}
106 PERL= {- $config{perl} -}
107 #RM= echo --
108 RM= rm -f
109 TAR= tar
110 TARFLAGS= --no-recursion
111 MAKEDEPPROG=$(CROSS_COMPILE){- $config{makedepprog} -}
112
113 # We let the C compiler driver to take care of .s files. This is done in
114 # order to be excused from maintaining a separate set of architecture
115 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
116 # gcc, then the driver will automatically translate it to -xarch=v8plus
117 # and pass it down to assembler.
118 AS=$(CC) -c
119 ASFLAG=$(CFLAG)
120
121 # For x86 assembler: Set PROCESSOR to 386 if you want to support
122 # the 80386.
123 PROCESSOR= {- $config{processor} -}
124
125 # CPUID module collects small commonly used assembler snippets
126 APPS_OBJ={- $target{apps_obj} -}
127 CPUID_OBJ= {- $target{cpuid_obj} -}
128 UPLINK_OBJ= {- $target{uplink_obj} -}
129 BN_ASM= {- $target{bn_obj} -}
130 EC_ASM= {- $target{ec_obj} -}
131 DES_ENC= {- $target{des_obj} -}
132 AES_ENC= {- $target{aes_obj} -}
133 BF_ENC= {- $target{bf_obj} -}
134 CAST_ENC= {- $target{cast_obj} -}
135 RC4_ENC= {- $target{rc4_obj} -}
136 RC5_ENC= {- $target{rc5_obj} -}
137 MD5_ASM_OBJ= {- $target{md5_obj} -}
138 SHA1_ASM_OBJ= {- $target{sha1_obj} -}
139 RMD160_ASM_OBJ= {- $target{rmd160_obj} -}
140 BLAKE2_OBJ= {- $target{blake2_obj} -}
141 WP_ASM_OBJ= {- $target{wp_obj} -}
142 CMLL_ENC= {- $target{cmll_obj} -}
143 MODES_ASM_OBJ= {- $target{modes_obj} -}
144 PADLOCK_ASM_OBJ= {- $target{padlock_obj} -}
145 CHACHA_ENC= {- $target{chacha_obj} -}
146 POLY1305_ASM_OBJ= {- $target{poly1305_obj} -}
147 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
148
149 # Zlib stuff
150 ZLIB_INCLUDE={- $withargs{zlib_include} -}
151 LIBZLIB={- $withargs{zlib_lib} -}
152
153 # This is the location of fipscanister.o and friends.
154 # The FIPS module build will place it $(INSTALLTOP)/lib
155 # but since $(INSTALLTOP) can only take the default value
156 # when the module is built it will be in /usr/local/ssl/lib
157 # $(INSTALLTOP) for this build may be different so hard
158 # code the path.
159
160 FIPSLIBDIR={- $config{fipslibdir} -}
161
162 # The location of the library which contains fipscanister.o
163 # normally it will be libcrypto. If not compiling in FIPS mode
164 # at all this is empty making it a useful test for a FIPS compile.
165
166 FIPSCANLIB={- $config{fips} ? "libcrypto" : "" -}
167
168 # Shared library base address. Currently only used on Windows.
169 #
170
171 BASEADDR={- $config{baseaddr} -}
172
173 DIRS=   {- join(" ", @{$config{dirs}}) -}
174 SHLIBDIRS= crypto ssl
175 INSTALL_SUBS= engines apps tools
176
177 # dirs in crypto to build
178 SDIRS=  {- join(" ", @{$config{sdirs}}) -}
179
180 # tests to perform.  "alltests" is a special word indicating that all tests
181 # should be performed.
182 TESTS = alltests
183
184 MAKEFILE= Makefile
185
186 MANDIR=$(INSTALLTOP)/share/man
187 MAN1=1
188 MAN3=3
189 MANSUFFIX=
190 HTMLSUFFIX=html
191 HTMLDIR=$(INSTALLTOP)/share/doc/$(BASENAME)/html
192 SHELL=/bin/sh
193
194 TOP=    .
195 LIBS=   libcrypto.a libssl.a
196 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
197 SHARED_SSL=libssl$(SHLIB_EXT)
198 SHARED_LIBS={- $disabled{shared} ? '' : '$(SHARED_CRYPTO) $(SHARED_SSL)'  -}
199 SHARED_CFLAG={- $target{shared_cflag} -}
200 SHARED_LDFLAG={- $target{shared_ldflag}." ".$config{shared_ldflag}
201                  # Unlike other OSes (like Solaris, Linux, Tru64,
202                  # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
203                  # and FreeBSD) "demand" RPATH set on .so objects.
204                  # Apparently application RPATH is not global and
205                  # does not apply to .so linked with other .so.
206                  # Problem manifests itself when libssl.so fails to
207                  # load libcrypto.so. One can argue that we should
208                  # engrave this into Makefile.shared rules or into
209                  # BSD-* config lines above. Meanwhile let's try to
210                  # be cautious and pass -rpath to linker only when
211                  # $prefix is not /usr.
212                  . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
213                     ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
214 SHARED_RCFLAG={- $target{shared_rcflag} -}
215 DYNAMIC_ENGINES={- $config{dynamic_engines} -}
216
217 GENERAL=        Makefile
218 BASENAME=       openssl
219 NAME=           $(BASENAME)-$(VERSION)
220 TARFILE=        ../$(NAME).tar
221 HEADER=         e_os.h
222
223 # Directories created on install if they don't exist.
224 INSTALLDIRS=    \
225                 $(DESTDIR)$(INSTALLTOP)/bin \
226                 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) \
227                 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines \
228                 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
229                 $(DESTDIR)$(INSTALLTOP)/include/openssl \
230                 $(DESTDIR)$(OPENSSLDIR)/misc \
231                 $(DESTDIR)$(OPENSSLDIR)/certs \
232                 $(DESTDIR)$(OPENSSLDIR)/private
233
234 ENGDIRS={- join(" ", @{$config{engdirs}}) -}
235
236 all: Makefile build_all_but_tests
237
238 # as we stick to -e, CLEARENV ensures that local variables in lower
239 # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
240 # shell, which [annoyingly enough] terminates unset with error if VAR
241 # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
242 # which terminates unset with error if no variable was present:-(
243 CLEARENV=       TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}     \
244                 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}       \
245                 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}           \
246                 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
247                 $${HEADER+HEADER}                               \
248                 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS}           \
249                 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}           \
250                 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
251                 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}     \
252                 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
253
254 # LC_ALL=C ensures that error [and other] messages are delivered in
255 # same language for uniform treatment.
256 BUILDENV=       LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
257                 CC='$(CC)' CFLAG='$(CFLAG)' CFLAG_Q='$(CFLAG_Q)'        \
258                 SHARED_CFLAG='$(SHARED_CFLAG)'                          \
259                 AS='$(CC)' ASFLAG='$(CFLAG) -c'                 \
260                 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'        \
261                 CROSS_COMPILE='$(CROSS_COMPILE)'                \
262                 PERL='$(PERL)' DYNAMIC_ENGINES='$(DYNAMIC_ENGINES)'     \
263                 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'     \
264                 DESTDIR='$(DESTDIR)'            \
265                 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'   \
266                 LIBDIR='$(LIBDIR)'                              \
267                 SHARED_LDFLAG='$(SHARED_LDFLAG)'                \
268                 SHARED_RCFLAG='$(SHARED_RCFLAG)'                \
269                 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
270                 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
271                 SHLIB_EXT='$(SHLIB_EXT)' DSO_EXT='$(DSO_EXT)'   \
272                 SHLIB_TARGET='$(SHLIB_TARGET)'  \
273                 LDFLAG='$(LDFLAG)'                              \
274                 PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)'       \
275                 APPS_OBJ='$(APPS_OBJ)' UPLINK_OBJ='$(UPLINK_OBJ)'       \
276                 CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)'     \
277                 EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)'         \
278                 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'     \
279                 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'       \
280                 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'       \
281                 ENGDIRS='$(ENGDIRS)'    \
282                 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'                  \
283                 MD5_ASM_OBJ='$(MD5_ASM_OBJ)'                    \
284                 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'              \
285                 BLAKE2_OBJ='$(BLAKE2_OBJ)'                      \
286                 WP_ASM_OBJ='$(WP_ASM_OBJ)'                      \
287                 MODES_ASM_OBJ='$(MODES_ASM_OBJ)'                \
288                 PADLOCK_ASM_OBJ='$(PADLOCK_ASM_OBJ)'            \
289                 CHACHA_ENC='$(CHACHA_ENC)'                      \
290                 POLY1305_ASM_OBJ='$(POLY1305_ASM_OBJ)'          \
291                 PERLASM_SCHEME='$(PERLASM_SCHEME)'              \
292                 FIPSLIBDIR='${FIPSLIBDIR}'                      \
293                 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"      \
294                 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
295 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
296 # which in turn eliminates ambiguities in variable treatment with -e.
297
298 # BUILD_CMD is a generic macro to build a given target in a given
299 # subdirectory.  The target must be given through the shell variable
300 # `target' and the subdirectory to build in must be given through `dir'.
301 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
302 # BUILD_ONE_CMD instead.
303 #
304 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
305 # subdirectories defined in $(DIRS).  It requires that the target
306 # is given through the shell variable `target'.
307 #
308 # BUILD_ONE_CMD is a macro to build a given target in a given
309 # subdirectory if that subdirectory is part of $(DIRS).  It requires
310 # exactly the same shell variables as BUILD_CMD.
311 BUILD_CMD=  if [ -d "$$dir" ]; then \
312             (   cd $$dir && echo "making $$target in $$dir..." && \
313                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
314             ) || exit 1; \
315             fi
316 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
317 BUILD_ONE_CMD=\
318         if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
319                 $(BUILD_CMD); \
320         fi
321
322 reflect:
323         @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
324
325 sub_all: build_all
326
327 build_all_but_tests: build_libs build_apps build_tools
328 build_all: build_all_but_tests build_tests
329
330 build_libs: build_libcrypto build_libssl openssl.pc
331
332 build_libcrypto: build_crypto build_engines libcrypto.pc
333 build_libssl: build_ssl libssl.pc
334
335 build_crypto:
336         @dir=crypto; target=all; $(BUILD_ONE_CMD)
337 build_ssl: build_crypto
338         @dir=ssl; target=all; $(BUILD_ONE_CMD)
339 build_engines: build_crypto
340         @dir=engines; target=all; AS='$(CC) -c'; export AS; $(BUILD_ONE_CMD)
341
342 build_apps: build_libs
343         @dir=apps; target=all; $(BUILD_ONE_CMD)
344 build_tests: build_libs
345         @dir=test; target=all; $(BUILD_ONE_CMD)
346 build_tools: build_libs
347         @dir=tools; target=all; $(BUILD_ONE_CMD)
348
349 all_testapps: build_libs build_testapps
350 build_testapps:
351         @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
352
353 libcrypto$(SHLIB_EXT): libcrypto.a
354         @if [ "$(SHLIB_TARGET)" != "" ]; then \
355                 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
356                         FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
357                         export CC FIPSLD_CC; \
358                 fi; \
359                 $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared; \
360         else \
361                 echo "There's no support for shared libraries on this platform" >&2; \
362                 exit 1; \
363         fi
364
365 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
366         @if [ "$(SHLIB_TARGET)" != "" ]; then \
367                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
368         else \
369                 echo "There's no support for shared libraries on this platform" >&2; \
370                 exit 1; \
371         fi
372
373 link-shared:
374         @ set -e; for i in $(SHLIBDIRS); do \
375                 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
376                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
377                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
378                         symlink.$(SHLIB_TARGET); \
379                 libs="$$libs -l$$i"; \
380         done
381
382 build-shared: do_$(SHLIB_TARGET) link-shared
383
384 do_$(SHLIB_TARGET):
385         @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
386                 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
387                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
388                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
389                         LIBDEPS="$$libs $(EX_LIBS)" \
390                         link_shlib.$(SHLIB_TARGET); \
391                 libs="-l$$i $$libs"; \
392                 case "$(PLATFORM)" in \
393                 Cygwin*) \
394                         rm -f apps/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
395                         rm -f test/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
396                         cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll apps/; \
397                         cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll test/; \
398                         ;; \
399                 mingw*) \
400                         arch=; \
401                         if expr $(PLATFORM) : mingw64 > /dev/null; then \
402                                 arch=-x64; \
403                         fi; \
404                         rm -f apps/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
405                         rm -f test/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
406                         cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll apps/; \
407                         cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll test/; \
408                         ;; \
409                 esac; \
410         done
411
412 libcrypto.pc: Makefile
413         @ ( echo 'prefix=$(INSTALLTOP)'; \
414             echo 'exec_prefix=$${prefix}'; \
415             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
416             echo 'includedir=$${prefix}/include'; \
417             echo ''; \
418             echo 'Name: OpenSSL-libcrypto'; \
419             echo 'Description: OpenSSL cryptography library'; \
420             echo 'Version: '$(VERSION); \
421             echo 'Requires: '; \
422             echo 'Libs: -L$${libdir} -lcrypto'; \
423             echo 'Libs.private: $(EX_LIBS)'; \
424             echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
425
426 libssl.pc: Makefile
427         @ ( echo 'prefix=$(INSTALLTOP)'; \
428             echo 'exec_prefix=$${prefix}'; \
429             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
430             echo 'includedir=$${prefix}/include'; \
431             echo ''; \
432             echo 'Name: OpenSSL-libssl'; \
433             echo 'Description: Secure Sockets Layer and cryptography libraries'; \
434             echo 'Version: '$(VERSION); \
435             echo 'Requires.private: libcrypto'; \
436             echo 'Libs: -L$${libdir} -lssl'; \
437             echo 'Libs.private: $(EX_LIBS)'; \
438             echo 'Cflags: -I$${includedir}' ) > libssl.pc
439
440 openssl.pc: Makefile
441         @ ( echo 'prefix=$(INSTALLTOP)'; \
442             echo 'exec_prefix=$${prefix}'; \
443             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
444             echo 'includedir=$${prefix}/include'; \
445             echo ''; \
446             echo 'Name: OpenSSL'; \
447             echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
448             echo 'Version: '$(VERSION); \
449             echo 'Requires: libssl libcrypto' ) > openssl.pc
450
451 Makefile: Makefile.in Configure config
452         @echo "Makefile is older than Makefile.in, Configure or config."
453         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
454         @false
455
456 libclean:
457         rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
458
459 clean:  libclean
460         rm -f */*/*.o */*.o *.o core a.out fluff testlog make.log cctest cctest.c
461         rm -rf *.bak certs/.0
462         @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
463         rm -f $(LIBS) tags TAGS
464         rm -f openssl.pc libssl.pc libcrypto.pc
465         rm -f speed.* .pure
466         rm -f $(TARFILE)
467
468 makefile.one: files
469         $(PERL) util/mk1mf.pl >makefile.one; \
470         sh util/do_ms.sh
471
472 files:
473         $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
474         @set -e; target=files; $(RECURSIVE_BUILD_CMD)
475
476 gentests:
477         @(cd test && echo "generating dummy tests (if needed)..." && \
478         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
479
480 test:   files tests
481
482 tests:  build_tests 
483         @(cd test && echo "testing..." && \
484         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
485         @if [ -z "$(CROSS_COMPILE)" ]; then \
486                 OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a; \
487         fi
488
489 list-tests:
490         @(cd test && \
491                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. list-tests)
492
493 report:
494         @$(PERL) util/selftest.pl
495
496 tags TAGS: FORCE
497         rm -f TAGS tags
498         -ctags -R .
499         -etags `find . -name '*.[ch]' -o -name '*.pm'`
500
501 FORCE:
502
503 depend:
504         @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
505
506 update: generate errors ordinals depend
507
508 generate:
509         (cd apps && PERL='${PERL}' $(MAKE) generate)
510         (cd crypto/bn && PERL='${PERL}' $(MAKE) generate)
511         (cd crypto/objects && PERL='${PERL}' $(MAKE) generate)
512
513 errors:
514         $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
515         $(PERL) util/mkerr.pl -recurse -write
516         (cd engines; $(MAKE) PERL=$(PERL) errors)
517
518 ordinals: util/libcrypto.num util/libssl.num test_ordinals TABLE
519 util/libcrypto.num::
520         $(PERL) util/mkdef.pl crypto update
521 util/libssl.num::
522         $(PERL) util/mkdef.pl ssl update
523 test_ordinals:
524         TOP=$(TOP) PERL=$(PERL) $(PERL) test/run_tests.pl test_ordinals
525
526 TABLE: Configure Configurations/*.conf
527         (echo 'Output of `Configure TABLE'"':"; \
528         $(PERL) Configure TABLE) > TABLE
529
530 # Build distribution tar-file. As the list of files returned by "find" is
531 # pretty long, on several platforms a "too many arguments" error or similar
532 # would occur. Therefore the list of files is temporarily stored into a file
533 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
534 # tar does not support the --files-from option.
535 TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
536                                --owner 0 --group 0 \
537                                --transform 's|^|$(NAME)/|' \
538                                -cvf -
539
540 $(TARFILE).list:
541         git diff --quiet HEAD
542         git ls-files | sort > $(TARFILE).list
543
544 tar: $(TARFILE).list
545         find . -type d -print | xargs chmod 755
546         find . -type f -print | xargs chmod a+r
547         find . -type f -perm -0100 -print | xargs chmod a+x
548         $(TAR_COMMAND) | gzip --best > $(TARFILE).gz
549         rm -f $(TARFILE).list
550         ls -l $(TARFILE).gz
551
552 tar-snap: $(TARFILE).list
553         $(TAR_COMMAND) > $(TARFILE)
554         rm -f $(TARFILE).list
555         ls -l $(TARFILE)
556
557 dist:
558         $(PERL) Configure dist
559         @$(MAKE) SDIRS='$(SDIRS)' clean
560         @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
561
562 install: all install_docs install_sw
563
564 uninstall: uninstall_sw uninstall_docs
565
566 install_sw:
567         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALLDIRS)
568         @set -e; for i in include/openssl/*.h; do \
569         (cp $$i $(DESTDIR)$(INSTALLTOP)/$$i; \
570         chmod 644 $(DESTDIR)$(INSTALLTOP)/$$i ); \
571         done;
572         @set -e; target=install; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
573         @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
574         do \
575                 if [ -f "$$i" ]; then \
576                 (       echo installing $$i; \
577                         cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
578                         $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
579                         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
580                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
581                 fi; \
582         done;
583         @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
584                 tmp="$(SHARED_LIBS)"; \
585                 for i in $${tmp:-x}; \
586                 do \
587                         if [ -f "$$i" -o -f "$$i.a" ]; then \
588                                 case "$(PLATFORM)" in \
589                                 Cygwin*) \
590                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
591                                         echo installing $$c; \
592                                         cp $$c $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
593                                         chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
594                                         mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$c.new $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
595                                         echo installing $$i.a; \
596                                         cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
597                                         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
598                                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
599                                         ;; \
600                                 mingw*) \
601                                         arch=; \
602                                         if expr $(PLATFORM) : mingw64 > /dev/null; then \
603                                                 arch=-x64; \
604                                         fi; \
605                                         m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
606                                         echo installing $$m; \
607                                         cp $$m $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
608                                         chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
609                                         mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$m.new $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
610                                         echo installing $$i.a; \
611                                         cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
612                                         chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
613                                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
614                                         ;; \
615                                 *) \
616                                         echo installing $$i; \
617                                         cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
618                                         chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
619                                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
620                                         ;; \
621                                 esac; \
622                         fi; \
623                 done; \
624                 (       here="`pwd`"; \
625                         cd $(DESTDIR)$(INSTALLTOP)/$(LIBDIR); \
626                         $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
627                 if [ "$(INSTALLTOP)" != "/usr" ]; then \
628                         echo 'OpenSSL shared libraries have been installed in:'; \
629                         echo '  $(INSTALLTOP)'; \
630                 fi; \
631         fi
632         cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
633         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
634         cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
635         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
636         cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
637         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
638
639 uninstall_sw:
640         cd include/openssl && files=* && cd $(DESTDIR)$(INSTALLTOP)/include/openssl && $(RM) $$files
641         @for i in $(LIBS) ;\
642         do \
643                 test -f "$$i" && \
644                 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i && \
645                 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
646         done;
647         @if [ -n "$(SHARED_LIBS)" ]; then \
648                 tmp="$(SHARED_LIBS)"; \
649                 for i in $${tmp:-x}; \
650                 do \
651                         if [ -f "$$i" -o -f "$$i.a" ]; then \
652                                 case "$(PLATFORM)" in \
653                                 Cygwin*) \
654                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
655                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
656                                         $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
657                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
658                                         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
659                                         ;; \
660                                 mingw*) \
661                                         arch=; \
662                                         if expr $(PLATFORM) : mingw64 > /dev/null; then \
663                                                 arch=-x64; \
664                                         fi; \
665                                         m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
666                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
667                                         $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
668                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
669                                         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
670                                         ;; \
671                                 *) \
672                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
673                                         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
674                                         ;; \
675                                 esac; \
676                         fi; \
677                 done; \
678         fi
679         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
680         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
681         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
682         @target=uninstall; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
683
684 install_html_docs:
685         here="`pwd`"; \
686         filecase=; \
687         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
688                 filecase=-i; \
689         esac; \
690         for subdir in apps crypto ssl; do \
691                 $(PERL) $(TOP)/util/mkdir-p $(DESTDIR)$(HTMLDIR)/$$subdir; \
692                 for i in doc/$$subdir/*.pod; do \
693                         fn=`basename $$i .pod`; \
694                         echo "installing html/$$fn.$(HTMLSUFFIX)"; \
695                         cat $$i \
696                         | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
697                         | pod2html --podroot=doc --htmlroot=.. --podpath=$$subdir:apps:crypto:ssl \
698                         | sed -r 's/<!DOCTYPE.*//g' \
699                         > $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
700                         $(PERL) util/extract-names.pl < $$i | \
701                                 grep -v $$filecase "^$$fn\$$" | \
702                                 (cd $(DESTDIR)$(HTMLDIR)/$$subdir; \
703                                  while read n; do \
704                                         PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
705                                  done); \
706                 done; \
707         done
708
709 uninstall_html_docs:
710         here="`pwd`"; \
711         filecase=; \
712         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
713                 filecase=-i; \
714         esac; \
715         for subdir in apps crypto ssl; do \
716                 for i in doc/$$subdir/*.pod; do \
717                         fn=`basename $$i .pod`; \
718                         $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
719                         $(PERL) util/extract-names.pl < $$i | \
720                                 grep -v $$filecase "^$$fn\$$" | \
721                                 while read n; do \
722                                         $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/"$$n".$(HTMLSUFFIX); \
723                                 done; \
724                 done; \
725         done
726
727 install_docs:
728         @$(PERL) $(TOP)/util/mkdir-p.pl \
729                 $(DESTDIR)$(MANDIR)/man1 \
730                 $(DESTDIR)$(MANDIR)/man3 \
731                 $(DESTDIR)$(MANDIR)/man5 \
732                 $(DESTDIR)$(MANDIR)/man7
733         here="`pwd`"; \
734         filecase=; \
735         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
736                 filecase=-i; \
737         esac; \
738         set -e; for i in doc/apps/*.pod; do \
739                 fn=`basename $$i .pod`; \
740                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
741                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
742                 (cd `$(PERL) util/dirname.pl $$i`; \
743                 pod2man \
744                         --section=$$sec --center=OpenSSL \
745                         --release=$(VERSION) `basename $$i`) \
746                         >  $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
747                 $(PERL) util/extract-names.pl < $$i | \
748                         (grep -v $$filecase "^$$fn\$$"; true) | \
749                         (grep -v "[     ]"; true) | \
750                         (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
751                          while read n; do \
752                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
753                          done); \
754         done; \
755         set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
756                 fn=`basename $$i .pod`; \
757                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
758                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
759                 (cd `$(PERL) util/dirname.pl $$i`; \
760                 pod2man \
761                         --section=$$sec --center=OpenSSL \
762                         --release=$(VERSION) `basename $$i`) \
763                         >  $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
764                 $(PERL) util/extract-names.pl < $$i | \
765                         (grep -v $$filecase "^$$fn\$$"; true) | \
766                         (grep -v "[     ]"; true) | \
767                         (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
768                          while read n; do \
769                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
770                          done); \
771         done
772
773 uninstall_docs:
774         @here="`pwd`"; \
775         filecase=; \
776         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \
777                 filecase=-i; \
778         esac; \
779         for i in doc/apps/*.pod; do \
780                 fn=`basename $$i .pod`; \
781                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
782                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
783                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
784                 $(PERL) util/extract-names.pl < $$i | \
785                         (grep -v $$filecase "^$$fn\$$"; true) | \
786                         (grep -v "[     ]"; true) | \
787                         while read n; do \
788                                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
789                                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
790                         done; \
791         done; \
792         for i in doc/crypto/*.pod doc/ssl/*.pod; do \
793                 fn=`basename $$i .pod`; \
794                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
795                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
796                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
797                 $(PERL) util/extract-names.pl < $$i | \
798                         (grep -v $$filecase "^$$fn\$$"; true) | \
799                         (grep -v "[     ]"; true) | \
800                         while read n; do \
801                                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
802                                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
803                         done; \
804         done
805
806 # DO NOT DELETE THIS LINE -- make depend depends on it.