release_cflags => "-O3",
thread_cflag => "-D_REENTRANT",
sys_id => "MACOSX",
- lflags => "-Wl,-search_paths_first",
+ plib_lflags => "-Wl,-search_paths_first",
bn_ops => "BN_LLONG RC4_CHAR",
perlasm_scheme => "osx32",
dso_scheme => "dlfcn",
cc => "$ENV{'CC'}",
cflags => "\$(CFLAGS)",
thread_cflag => "-D_REENTRANT",
- lflags => "\$(LDFLAGS)",
+ plib_lflags => "\$(LDFLAGS)",
ex_libs => "\$(LDLIBS)",
bn_ops => "BN_LLONG",
dso_scheme => "$ENV{'LIBSSL_dlfcn'}",
cc => "$ENV{'CC'}",
cflags => "\$(CFLAGS)",
thread_cflag => "-D_REENTRANT",
- lflags => "\$(LDFLAGS)",
+ plib_lflags => "\$(LDFLAGS)",
ex_libs => "\$(LDLIBS)",
bn_ops => "SIXTY_FOUR_BIT_LONG",
dso_scheme => "$ENV{'LIBSSL_dlfcn'}",
cflags => "$gcc_devteam_warn -Wno-language-extension-token -Wno-extended-offsetof -arch x86_64 -O3 -DL_ENDIAN -DMD32_REG_T=int -Wall",
thread_cflag => "-D_REENTRANT",
sys_id => "MACOSX",
- lflags => "-Wl,-search_paths_first",
+ plib_lflags => "-Wl,-search_paths_first",
bn_ops => "SIXTY_FOUR_BIT_LONG",
perlasm_scheme => "macosx",
dso_scheme => "dlfcn",
compiling for shared libraries, typically
something like "-fPIC".
- ld => the linker command, usually not defined
+ (linking is a complex thing, see [3] below)
+ ld => Linker command, usually not defined
(meaning the compiler command is used
instead).
(NOTE: this is here for future use, it's
not implemented yet)
- lflags => the flags that are used at all times when
- linking. These can have a % sign in them
- showing where the OpenSSL libraries should
- appear, otherwise these flags will come
- last. So in a typical links situation,
- this is a quick table of results:
-
- "-foo%-bar" > -foo -lssl -lcrypto -bar
- "-foo%" > -foo -lssl -lcrypto
- "-foo" > -lssl -lcrypto -foo
+ lflags => Flags that are used when linking apps.
+ shared_ldflag => Flags that are used when linking shared
+ or dynamic libraries.
+ plib_lflags => Extra linking flags to appear just before
+ the libraries on the command line.
+ ex_libs => Extra libraries that are needed when
+ linking.
debug_lflags => Like debug_cflags, but used when linking.
release_lflags => Like release_cflags, but used when linking.
- shared_lflags => Like shared_cflags, but used when linking.
ar => The library archive command, the default is
"ar".
be "(unknown)", in which case the user MUST give some compilation
flags to Configure.
+[3] OpenSSL has three types of things to link from object files or
+ static libraries:
+
+ - shared libraries; that would be libcrypto and libssl.
+ - shared objects (sometimes called dynamic libraries); that would
+ be the engines.
+ - applications; those are apps/openssl and all the test apps.
+
+ Very roughly speaking, linking is done like this (words in braces
+ represent the configuration settings documented at the beginning
+ of this file):
+
+ shared libraries:
+ {ld} $(CFLAGS) {shared_ldflag} -shared -o libfoo.so \
+ -Wl,--whole-archive libfoo.a -Wl,--no-whole-archive \
+ {plib_lflags} -lcrypto {ex_libs}
+
+ shared objects:
+ {ld} $(CFLAGS) {shared_ldflag} -shared -o libeng.so \
+ blah1.o blah2.o {plib_lflags} -lcrypto {ex_libs}
+
+ applications:
+ {ld} $(CFLAGS) {lflags} -o app \
+ app1.o utils.o {plib_lflags} -lssl -lcrypto {ex_libs}
+
Historically, the target configurations came in form of a string with
values separated by colons. This use is deprecated. The string form
# Allow environment CC to override compiler...
$target{cc} = $ENV{CC} || $target{cc};
-# For cflags, lflags and ex_libs, add the debug_ or release_ attributes
+# For cflags, lflags, plib_lflags and ex_libs, add the debug_ or release_
+# attributes.
# Do it in such a way that no spurious space is appended (hence the grep).
$config{cflags} = join(" ",
grep { $_ ne "" } ($target{cflags},
$config{lflags} = join(" ",
grep { $_ ne "" } ($target{lflags},
$target{$build_prefix."lflags"}));
+$config{plib_lflags} = join(" ",
+ grep { $_ ne "" } ($target{plib_lflags},
+ $target{$build_prefix."plib_lflags"}));
$config{ex_libs} = join(" ",
grep { $_ ne "" } ($target{ex_libs},
$target{$build_prefix."ex_libs"}));
print "IsMK1MF =", ($target{build_scheme}->[0] eq "mk1mf" ? "yes" : "no"), "\n";
print "CC =$target{cc}\n";
print "CFLAG =$config{cflags}\n";
-print "LFLAGS =$config{lflags}\n";
+print "LFLAG =$config{lflags}\n";
+print "PLIB_LFLAG =$config{plib_lflags}\n";
print "EX_LIBS =$config{ex_libs}\n";
print "CPUID_OBJ =$target{cpuid_obj}\n";
print "BN_ASM =$target{bn_obj}\n";
"unistd",
"ld",
"lflags",
+ "plib_lflags",
"ex_libs",
"debug_lflags",
+ "debug_plib_lflags",
"debug_ex_libs",
"release_lflags",
+ "release_plib_lflags",
"release_ex_libs",
"bn_ops",
"cpuid_obj",
CC= $(CROSS_COMPILE){- $target{cc} -}
CFLAG= {- $config{cflags} -}
DEPFLAG= {- $config{depflags} -}
-LDFLAGS= {- $config{lflags} -}
+LDFLAG= {- $config{lflags} -}
+PLIB_LDFLAG= {- $config{plib_lflags} -}
EX_LIBS= {- $config{ex_libs} -}
EXE_EXT= {- $target{exe_extension} -}
ARFLAGS= {- $target{arflags} -}
SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
SHARED_SSL=libssl$(SHLIB_EXT)
SHARED_LIBS={- '$(SHARED_CRYPTO) $(SHARED_SSL)' if (!$config{no_shared}) -}
-SHARED_LDFLAGS={- $target{shared_ldflag} -}
+SHARED_LDFLAG={- $target{shared_ldflag} -}
GENERAL= Makefile
BASENAME= openssl
INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)' \
LIBDIR='$(LIBDIR)' \
DEPFLAG='$(DEPFLAG)' \
- SHARED_LDFLAGS='$(SHARED_LDFLAGS)' \
+ SHARED_LDFLAG='$(SHARED_LDFLAG)' \
ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)' \
EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)' \
SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
- LDFLAGS='$(LDFLAGS)' EX_LIBS='$(EX_LIBS)' \
+ LDFLAG='$(LDFLAG)' \
+ PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)' \
CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)' \
EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)' \
AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)' \
# LDFLAGS contains flags to be used when temporary object files (when building
# shared libraries) are created, or when an application is linked.
# SHARED_LDFLAGS contains flags to be used when the shared library is created.
-LDFLAGS=
-SHARED_LDFLAGS=
+LDFLAGS=$(LDFLAG)
+SHARED_LDFLAGS=$(SHARED_LDFLAG)
NM=nm
LINK_APP= \
( $(SET_X); \
LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
- LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
+ LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS) $(LDFLAGS)}"; \
LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"
-DO_GNU_APP=LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"
+DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"
#This is rather special. It's a special target with which one can link
#applications without bothering with any features that have anything to
fi; $(LINK_SO_A)
link_app.bsd:
@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
- LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBPATH)"; \
+ LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBPATH)"; \
fi; $(LINK_APP)
# For Darwin AKA Mac OS/X (dyld)
@if $(DETECT_GNU_LD); then \
$(DO_GNU_APP); \
else \
- LDFLAGS="$(CFLAGS) -rpath $(LIBRPATH)"; \
+ LDFLAGS="$(CFLAGS) $(LDFLAGS) -rpath $(LIBRPATH)"; \
fi; \
$(LINK_APP)
@ if $(DETECT_GNU_LD); then \
$(DO_GNU_APP); \
else \
- LDFLAGS="$(CFLAGS) -R $(LIBRPATH)"; \
+ LDFLAGS="$(CFLAGS) $(LDFLAGS) -R $(LIBRPATH)"; \
fi; \
$(LINK_APP)
fi; \
$(LINK_SO_A)
link_app.irix:
- @LDFLAGS="$(CFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
+ @LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
$(LINK_APP)
# 32-bit PA-RISC HP-UX embeds the -L pathname of libs we link with, so
$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
link_app.hpux:
@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
- LDFLAGS="$(CFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
+ LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
fi; \
$(LINK_APP)
SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
$(LINK_SO_A_VIA_O)
link_app.aix:
- LDFLAGS="$(CFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
+ LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
$(LINK_APP)
PERL= perl
RM= rm -f
-LDFLAGS=
+PLIB_LDFLAG=
EX_LIBS=
EXE_EXT=
LIBRARIES="$(LIBSSL) $(LIBCRYPTO)" ; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
APPNAME=$(EXE) OBJECTS="$(EXE_OBJ)" \
- LIBDEPS="$(LDFLAGS) $$LIBRARIES $(EX_LIBS)" \
+ LDFLAG="$(LDFLAG)" \
+ LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target}
progs.h: progs.pl Makefile
$(MAKE) -e TOP=../.. DIR=$$i INCLUDES='$(INCLUDES)' $$target ) || exit 1; \
done;
-LDFLAGS=
+PLIB_LDFLAG=
EX_LIBS=
CFLAGS= $(INCLUDE) $(CFLAG)
MAKEFILE= Makefile
AR= ar r
-LDFLAGS=
+PLIB_LDFLAG=
EX_LIBS=
CFLAGS= $(INCLUDES) $(CFLAG)
INSTALLTOP=/usr/local/ssl
AR= ar r
-LDFLAGS=
+PLIB_LDFLAG=
EX_LIBS=
CFLAGS= $(INCLUDES) $(CFLAG)
PADLOCK_ASM_OBJ=
-LDFLAGS=
+PLIB_LDFLAG=
EX_LIBS=
CFLAGS= $(INCLUDES) $(CFLAG)
for l in $(LIBNAMES) $(TESTLIBNAMES); do \
$(MAKE) -f ../Makefile.shared -e \
LIBNAME=$$l LIBEXTRAS="e_$$l*.o" \
- LIBDEPS='-L.. -lcrypto $(EX_LIBS)' \
+ LIBDEPS='$(PLIB_LDFLAG) -L.. -lcrypto $(EX_LIBS)' \
link_o.$(SHLIB_TARGET); \
done; \
else \
MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
PERL= perl
-LDFLAGS=
+PLIB_LDFLAG=
EX_LIBS= #-lnsl -lsocket
CFLAGS= $(INCLUDES) $(CFLAG)
+LDFLAGS= $(CFLAGS) $(LDFLAG)
GENERAL=Makefile maketests.com \
tests.com testenc.com tx509.com trsa.com tcrl.com tsid.com treq.com \
LIBRARIES="$(LIBSSL) $(LIBCRYPTO)"; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o $$testutil" \
- LIBDEPS="$(LDFLAGS) $$LIBRARIES $(EX_LIBS)" \
+ LDFLAG="$(LDFLAG)" \
+ LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target}
BUILD_CMD_STATIC=shlib_target=; \
LIBRARIES="$(DLIBSSL) $(DLIBCRYPTO)"; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o $$testutil" \
- LIBDEPS="$(LDFLAGS) $$LIBRARIES $(EX_LIBS)" \
+ LDFLAG="$(LDFLAG)" \
+ LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target}
$(RSATEST)$(EXE_EXT): $(RSATEST).o $(DLIBCRYPTO)
fi; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
CC="$${CC}" APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
- LIBDEPS="$(LDFLAGS) $$LIBRARIES $(EX_LIBS)" \
+ LDFLAG="$(LDFLAG)" \
+ LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target}
FIPS_CRYPTO_BUILD_CMD=shlib_target=; if [ -n "$(SHARED_LIBS)" ]; then \
[ "$(FIPSCANLIB)" = "libfips" ] && LIBRARIES="$$LIBRARIES -lfips"; \
$(MAKE) -f $(TOP)/Makefile.shared -e \
CC="$${CC}" APPNAME=$$target$(EXE_EXT) OBJECTS="$$target.o" \
- LIBDEPS="$(LDFLAGS) $$LIBRARIES $(EX_LIBS)" \
+ LDFLAG="$(LDFLAG)" \
+ LIBDEPS="$(PLIB_LDFLAG) $$LIBRARIES $(EX_LIBS)" \
link_app.$${shlib_target}
$(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
$(DTLSV1LISTENTEST)$(EXE_EXT): $(DTLSV1LISTENTEST).o
@target=$(DTLSV1LISTENTEST) $(BUILD_CMD)
-#$(AESTEST).o: $(AESTEST).c
-# $(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
-
-#$(AESTEST)$(EXE_EXT): $(AESTEST).o $(DLIBCRYPTO)
-# if [ "$(SHLIB_TARGET)" = "hpux-shared" -o "$(SHLIB_TARGET)" = "darwin-shared" ] ; then \
-# $(CC) -o $(AESTEST)$(EXE_EXT) $(CFLAGS) $(AESTEST).o $(LDFLAGS) $(DLIBCRYPTO) $(EX_LIBS) ; \
-# else \
-# $(CC) -o $(AESTEST)$(EXE_EXT) $(CFLAGS) $(AESTEST).o $(LDFLAGS) $(LIBCRYPTO) $(EX_LIBS) ; \
-# fi
-
dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
@target=dummytest; $(BUILD_CMD)