diff options
author | Richard Levitte <levitte@openssl.org> | 2018-01-23 13:54:55 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2018-01-28 07:26:10 +0100 |
commit | 8c3bc594e0c74926bfefb84b8bae8a2fac82e465 (patch) | |
tree | 7875c47a8ecd68f42f701e6f3602a8cc0c4fe0dc /Configurations | |
parent | df05f155a69b96b174e0e47bc689bf729de684b6 (diff) |
Processing GNU-style "make variables" - separate CPP flags from C flags
C preprocessor flags get separated from C flags, which has the
advantage that we don't get loads of macro definitions and inclusion
directory specs when linking shared libraries, DSOs and programs.
This is a step to add support for "make variables" when configuring.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5177)
Diffstat (limited to 'Configurations')
-rw-r--r-- | Configurations/00-base-templates.conf | 2 | ||||
-rw-r--r-- | Configurations/10-main.conf | 364 | ||||
-rw-r--r-- | Configurations/README | 18 | ||||
-rw-r--r-- | Configurations/descrip.mms.tmpl | 33 | ||||
-rw-r--r-- | Configurations/unix-Makefile.tmpl | 38 | ||||
-rw-r--r-- | Configurations/windows-makefile.tmpl | 38 |
6 files changed, 329 insertions, 164 deletions
diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf index f1539929ef..1a2964520a 100644 --- a/Configurations/00-base-templates.conf +++ b/Configurations/00-base-templates.conf @@ -4,6 +4,8 @@ my %targets=( template => 1, cflags => "", + cppflags => "", + lflags => "", defines => [], thread_scheme => "(unknown)", # Assume we don't know thread_defines => [], diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index f085a90d11..9a27dc9065 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -107,7 +107,7 @@ sub vc_wince_info { $wcelflag.=" /machine:$wcetgt"; last; }; } - $vc_wince_info = { cflags => $wcecdefs, + $vc_wince_info = { cppflags => $wcecdefs, lflags => $wcelflag }; } return $vc_wince_info; @@ -164,9 +164,10 @@ my %targets = ( "vos-gcc" => { inherit_from => [ "BASE_unix" ], cc => "gcc", - cflags => picker(default => "-Wall -DOPENSSL_SYS_VOS -D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN", + cflags => picker(default => "-Wall", debug => "-O0 -g", release => "-O3"), + cppflags => "-D_POSIX_C_SOURCE=200112L -D_BSD -D_VOS_EXTENDED_NAMES -DB_ENDIAN", thread_scheme => "(unknown)", sys_id => "VOS", lflags => add("-Wl,-map"), @@ -178,7 +179,7 @@ my %targets = ( "solaris-common" => { inherit_from => [ "BASE_unix" ], template => 1, - cflags => "-DFILIO_H", + cppflags => "-DFILIO_H", ex_libs => add("-lsocket -lnsl -ldl"), dso_scheme => "dlfcn", thread_scheme => "pthreads", @@ -192,10 +193,11 @@ my %targets = ( # failures [at least] in 32-bit build. inherit_from => [ "solaris-common", asm("x86_elf_asm") ], cc => "gcc", - cflags => add_before(picker(default => "-Wall -DL_ENDIAN", + cflags => add_before(picker(default => "-Wall", debug => "-O0 -g", release => "-O3 -fomit-frame-pointer"), threads("-pthread")), + cppflags => add("-DL_DEBIAN"), ex_libs => add(threads("-pthread")), bn_ops => "BN_LLONG", shared_cflag => "-fPIC", @@ -212,10 +214,11 @@ my %targets = ( # -- <appro@openssl.org> inherit_from => [ "solaris-common", asm("x86_64_asm") ], cc => "gcc", - cflags => add_before(picker(default => "-m64 -Wall -DL_ENDIAN", + cflags => add_before(picker(default => "-m64 -Wall", debug => "-O0 -g", release => "-O3"), threads("-pthread")), + cppflags => add("-DL_DEBIAN"), ex_libs => add(threads("-pthread")), bn_ops => "SIXTY_FOUR_BIT_LONG", perlasm_scheme => "elf", @@ -240,10 +243,10 @@ my %targets = ( "solaris64-x86_64-cc" => { inherit_from => [ "solaris-common", asm("x86_64_asm") ], cc => "cc", - cflags => add_before(picker(default => "-xarch=generic64 -xstrconst -Xa -DL_ENDIAN", + cflags => add_before(picker(default => "-xarch=generic64 -xstrconst -Xa", debug => "-g", - release => "-xO5 -xdepend -xbuiltin"), - threads("-D_REENTRANT")), + release => "-xO5 -xdepend -xbuiltin")), + cppflags => add("-DL_DEBIAN", threads("-D_REENTRANT")), thread_scheme => "pthreads", lflags => add(threads("-mt")), ex_libs => add(threads("-lpthread")), @@ -258,10 +261,11 @@ my %targets = ( "solaris-sparcv7-gcc" => { inherit_from => [ "solaris-common" ], cc => "gcc", - cflags => add_before(picker(default => "-Wall -DB_ENDIAN -DBN_DIV2W", + cflags => add_before(picker(default => "-Wall", debug => "-O0 -g", release => "-O3"), threads("-pthread")), + cppflags => add("-DB_DEBIAN -DBN_DIV2W"), ex_libs => add(threads("-pthread")), bn_ops => "BN_LLONG RC4_CHAR", shared_cflag => "-fPIC", @@ -291,10 +295,11 @@ my %targets = ( "solaris-sparcv7-cc" => { inherit_from => [ "solaris-common" ], cc => "cc", - cflags => add_before(picker(default => "-xstrconst -Xa -DB_ENDIAN -DBN_DIV2W", + cflags => add_before(picker(default => "-xstrconst -Xa", debug => "-g", - release => "-xO5 -xdepend"), - threads("-D_REENTRANT")), + release => "-xO5 -xdepend")), + cppflags => add("-DB_DEBIAN -DBN_DIV2W", + threads("-D_REENTRANT")), lflags => add(threads("-mt")), ex_libs => add(threads("-lpthread")), bn_ops => "BN_LLONG RC4_CHAR", @@ -322,9 +327,10 @@ my %targets = ( "irix-mips3-gcc" => { inherit_from => [ "BASE_unix", asm("mips64_asm") ], cc => "gcc", - cflags => combine(picker(default => "-mabi=n32 -DB_ENDIAN -DBN_DIV3W", + cflags => combine(picker(default => "-mabi=n32", debug => "-g -O0", - release => "-O3"), + release => "-O3")), + cppflags => combine("-DB_DEBIAN -DBN_DIV3W", threads("-D_SGI_MP_SOURCE")), ex_libs => add(threads("-lpthread")), bn_ops => "RC4_CHAR SIXTY_FOUR_BIT", @@ -338,9 +344,10 @@ my %targets = ( "irix-mips3-cc" => { inherit_from => [ "BASE_unix", asm("mips64_asm") ], cc => "cc", - cflags => combine(picker(default => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W", + cflags => combine(picker(default => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared", debug => "-g -O0", - release => "-O2"), + release => "-O2")), + cppflags => combine("-DB_DEBIAN -DBN_DIV3W", threads("-D_SGI_MP_SOURCE")), ex_libs => add(threads("-lpthread")), bn_ops => "RC4_CHAR SIXTY_FOUR_BIT", @@ -355,9 +362,10 @@ my %targets = ( "irix64-mips4-gcc" => { inherit_from => [ "BASE_unix", asm("mips64_asm") ], cc => "gcc", - cflags => combine(picker(default => "-mabi=64 -mips4 -DB_ENDIAN -DBN_DIV3W", + cflags => combine(picker(default => "-mabi=64 -mips4", debug => "-g -O0", - release => "-O3"), + release => "-O3")), + cppflags => combine("-DB_DEBIAN -DBN_DIV3W", threads("-D_SGI_MP_SOURCE")), ex_libs => add(threads("-lpthread")), bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG", @@ -371,9 +379,10 @@ my %targets = ( "irix64-mips4-cc" => { inherit_from => [ "BASE_unix", asm("mips64_asm") ], cc => "cc", - cflags => combine(picker(default => "-64 -mips4 -use_readonly_const -G0 -rdata_shared -DB_ENDIAN -DBN_DIV3W", + cflags => combine(picker(default => "-64 -mips4 -use_readonly_const -G0 -rdata_shared", debug => "-g -O0", - release => "-O2"), + release => "-O2")), + cppflags => combine("-DB_DEBIAN -DBN_DIV3W", threads("-D_SGI_MP_SOURCE")), ex_libs => add(threads("-lpthread")), bn_ops => "RC4_CHAR SIXTY_FOUR_BIT_LONG", @@ -415,10 +424,10 @@ my %targets = ( "hpux-parisc-gcc" => { inherit_from => [ "BASE_unix" ], cc => "gcc", - cflags => combine(picker(default => "-DB_ENDIAN -DBN_DIV2W", - debug => "-O0 -g", + cflags => combine(picker(debug => "-O0 -g", release => "-O3"), threads("-pthread")), + cppflags => "-DB_DEBIAN -DBN_DIV2W", ex_libs => add("-Wl,+s -ldld", threads("-pthread")), bn_ops => "BN_LLONG", thread_scheme => "pthreads", @@ -435,10 +444,9 @@ my %targets = ( "hpux64-parisc2-gcc" => { inherit_from => [ "BASE_unix", asm("parisc20_64_asm") ], cc => "gcc", - cflags => combine(picker(default => "-DB_ENDIAN", - debug => "-O0 -g", - release => "-O3"), - threads("-D_REENTRANT")), + cflags => combine(picker(debug => "-O0 -g", + release => "-O3")), + cppflags => combine("-DB_DEBIAN", threads("-D_REENTRANT")), ex_libs => add("-ldl"), bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", thread_scheme => "pthreads", @@ -454,9 +462,10 @@ my %targets = ( "hpux-parisc-cc" => { inherit_from => [ "BASE_unix" ], cc => "cc", - cflags => combine(picker(default => "+Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY", + cflags => combine(picker(default => "+Optrs_strongly_typed -Ae +ESlit", debug => "+O0 +d -g", - release => "+O3"), + release => "+O3")), + cppflags => combine("-DB_DEBIAN -DBN_DIV2W -DMD32_XARRAY", threads("-D_REENTRANT")), ex_libs => add("-Wl,+s -ldld",threads("-lpthread")), bn_ops => "RC4_CHAR", @@ -475,9 +484,10 @@ my %targets = ( "hpux64-parisc2-cc" => { inherit_from => [ "BASE_unix", asm("parisc20_64_asm") ], cc => "cc", - cflags => combine(picker(default => "+DD64 +Optrs_strongly_typed -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY", + cflags => combine(picker(default => "+DD64 +Optrs_strongly_typed -Ae +ESlit", debug => "+O0 +d -g", - release => "+O3"), + release => "+O3")), + cppflags => combine("-DB_DEBIAN -DMD32_XARRAY", threads("-D_REENTRANT")), ex_libs => add("-ldl",threads("-lpthread")), bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", @@ -494,10 +504,10 @@ my %targets = ( "hpux-ia64-cc" => { inherit_from => [ "BASE_unix", asm("ia64_asm") ], cc => "cc", - cflags => combine(picker(default => "-Ae +DD32 +Olit=all -z -DB_ENDIAN", + cflags => combine(picker(default => "-Ae +DD32 +Olit=all -z", debug => "+O0 +d -g", - release => "+O2"), - threads("-D_REENTRANT")), + release => "+O2")), + cppflags => combine("-DB_DEBIAN", threads("-D_REENTRANT")), ex_libs => add("-ldl",threads("-lpthread")), bn_ops => "SIXTY_FOUR_BIT", thread_scheme => "pthreads", @@ -511,10 +521,10 @@ my %targets = ( "hpux64-ia64-cc" => { inherit_from => [ "BASE_unix", asm("ia64_asm") ], cc => "cc", - cflags => combine(picker(default => "-Ae +DD64 +Olit=all -z -DB_ENDIAN", + cflags => combine(picker(default => "-Ae +DD64 +Olit=all -z", debug => "+O0 +d -g", - release => "+O3"), - threads("-D_REENTRANT")), + release => "+O3")), + cppflags => combine("-DB_DEBIAN", threads("-D_REENTRANT")), ex_libs => add("-ldl", threads("-lpthread")), bn_ops => "SIXTY_FOUR_BIT_LONG", thread_scheme => "pthreads", @@ -529,10 +539,10 @@ my %targets = ( "hpux-ia64-gcc" => { inherit_from => [ "BASE_unix", asm("ia64_asm") ], cc => "gcc", - cflags => combine(picker(default => "-DB_ENDIAN", - debug => "-O0 -g", + cflags => combine(picker(debug => "-O0 -g", release => "-O3"), threads("-pthread")), + cppflags => "-DB_DEBIAN", ex_libs => add("-ldl", threads("-pthread")), bn_ops => "SIXTY_FOUR_BIT", thread_scheme => "pthreads", @@ -546,10 +556,11 @@ my %targets = ( "hpux64-ia64-gcc" => { inherit_from => [ "BASE_unix", asm("ia64_asm") ], cc => "gcc", - cflags => combine(picker(default => "-mlp64 -DB_ENDIAN", + cflags => combine(picker(default => "-mlp64", debug => "-O0 -g", release => "-O3"), threads("-pthread")), + cppflags => "-DB_DEBIAN", ex_libs => add("-ldl", threads("-pthread")), bn_ops => "SIXTY_FOUR_BIT_LONG", thread_scheme => "pthreads", @@ -565,7 +576,9 @@ my %targets = ( "MPE/iX-gcc" => { inherit_from => [ "BASE_unix" ], cc => "gcc", - cflags => "-D_ENDIAN -DBN_DIV2W -O3 -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB", + cflags => "-O3", + cppflags => "-D_ENDIAN -DBN_DIV2W -D_POSIX_SOURCE -D_SOCKET_SOURCE", + includes => [ "/SYSLOG/PUB" ], sys_id => "MPE", lflags => add("-L/SYSLOG/PUB"), ex_libs => add("-lsyslog -lsocket -lcurses"), @@ -580,8 +593,8 @@ my %targets = ( "tru64-alpha-gcc" => { inherit_from => [ "BASE_unix", asm("alpha_asm") ], cc => "gcc", - cflags => combine("-std=c9x -D_XOPEN_SOURCE=500 -D_OSF_SOURCE -O3", - threads("-pthread")), + cflags => combine("-std=c9x -O3", threads("-pthread")), + cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE", ex_libs => add("-lrt", threads("-pthread")), # for mlock(2) bn_ops => "SIXTY_FOUR_BIT_LONG", thread_scheme => "pthreads", @@ -592,8 +605,9 @@ my %targets = ( "tru64-alpha-cc" => { inherit_from => [ "BASE_unix", asm("alpha_asm") ], cc => "cc", - cflags => combine("-std1 -D_XOPEN_SOURCE=500 -D_OSF_SOURCE -tune host -fast -readonly_strings", + cflags => combine("-std1 -tune host -fast -readonly_strings", threads("-pthread")), + cppflags => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE", ex_libs => add("-lrt", threads("-pthread")), # for mlock(2) bn_ops => "SIXTY_FOUR_BIT_LONG", thread_scheme => "pthreads", @@ -616,12 +630,13 @@ my %targets = ( debug => "-O0 -g", release => "-O3"), threads("-pthread")), + cppflags => "-DOPENSSL_USE_NODELETE", ex_libs => add("-ldl", threads("-pthread")), bn_ops => "BN_LLONG RC4_CHAR", thread_scheme => "pthreads", dso_scheme => "dlfcn", shared_target => "linux-shared", - shared_cflag => "-fPIC -DOPENSSL_USE_NODELETE", + shared_cflag => "-fPIC", shared_ldflag => "-Wl,-znodelete", shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)", }, @@ -636,13 +651,15 @@ my %targets = ( }, "linux-ppc64" => { inherit_from => [ "linux-generic64", asm("ppc64_asm") ], - cflags => add("-m64 -DB_ENDIAN"), + cflags => add("-m64"), + cppflags => add("-DB_ENDIAN"), perlasm_scheme => "linux64", multilib => "64", }, "linux-ppc64le" => { inherit_from => [ "linux-generic64", asm("ppc64_asm") ], - cflags => add("-m64 -DL_ENDIAN"), + cflags => add("-m64"), + cppflags => add("-DL_ENDIAN"), perlasm_scheme => "linux64le", }, @@ -696,21 +713,24 @@ my %targets = ( # Configure script adds minimally required -march for assembly # support, if no -march was specified at command line. inherit_from => [ "linux-generic32", asm("mips32_asm") ], - cflags => add("-mabi=32 -DBN_DIV3W"), + cflags => add("-mabi=32"), + cppflags => add("-DBN_DIV3W"), perlasm_scheme => "o32", }, # mips32 and mips64 below refer to contemporary MIPS Architecture # specifications, MIPS32 and MIPS64, rather than to kernel bitness. "linux-mips64" => { inherit_from => [ "linux-generic32", asm("mips64_asm") ], - cflags => add("-mabi=n32 -DBN_DIV3W"), + cflags => add("-mabi=n32"), + cppflags => add("-DBN_DIV3W"), bn_ops => "SIXTY_FOUR_BIT RC4_CHAR", perlasm_scheme => "n32", multilib => "32", }, "linux64-mips64" => { inherit_from => [ "linux-generic64", asm("mips64_asm") ], - cflags => add("-mabi=64 -DBN_DIV3W"), + cflags => add("-mabi=64"), + cppflags => add("-DBN_DIV3W"), perlasm_scheme => "64", multilib => "64", }, @@ -720,16 +740,17 @@ my %targets = ( #### machines where gcc doesn't understand -m32 and -m64 "linux-elf" => { inherit_from => [ "linux-generic32", asm("x86_elf_asm") ], - cflags => add(picker(default => "-DL_ENDIAN", - release => "-fomit-frame-pointer")), + cflags => add(picker(release => "-fomit-frame-pointer")), + cppflags => add("-DL_ENDIAN"), bn_ops => "BN_LLONG", }, "linux-aout" => { inherit_from => [ "BASE_unix", asm("x86_asm") ], cc => "gcc", - cflags => add(picker(default => "-DL_ENDIAN -Wall", + cflags => add(picker(default => "-Wall", debug => "-O0 -g", release => "-O3 -fomit-frame-pointer")), + cppflags => add("-DL_ENDIAN"), bn_ops => "BN_LLONG", thread_scheme => "(unknown)", perlasm_scheme => "a.out", @@ -738,8 +759,9 @@ my %targets = ( #### X86 / X86_64 targets "linux-x86" => { inherit_from => [ "linux-generic32", asm("x86_asm") ], - cflags => add(picker(default => "-m32 -DL_ENDIAN", + cflags => add(picker(default => "-m32", release => "-fomit-frame-pointer")), + cppflags => add("-DL_ENDIAN"), bn_ops => "BN_LLONG", perlasm_scheme => "elf", }, @@ -751,7 +773,8 @@ my %targets = ( }, "linux-x86_64" => { inherit_from => [ "linux-generic64", asm("x86_64_asm") ], - cflags => add("-m64 -DL_ENDIAN"), + cflags => add("-m64"), + cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT_LONG", perlasm_scheme => "elf", multilib => "64", @@ -764,7 +787,8 @@ my %targets = ( }, "linux-x32" => { inherit_from => [ "linux-generic32", asm("x86_64_asm") ], - cflags => add("-mx32 -DL_ENDIAN"), + cflags => add("-mx32"), + cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT", perlasm_scheme => "elf32", multilib => "x32", @@ -777,7 +801,8 @@ my %targets = ( "linux64-s390x" => { inherit_from => [ "linux-generic64", asm("s390x_asm") ], - cflags => add("-m64 -DB_ENDIAN"), + cflags => add("-m64"), + cppflags => add("-DB_ENDIAN"), perlasm_scheme => "64", multilib => "64", }, @@ -799,7 +824,8 @@ my %targets = ( # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1... # inherit_from => [ "linux-generic32", asm("s390x_asm") ], - cflags => add("-m31 -Wa,-mzarch -DB_ENDIAN"), + cflags => add("-m31 -Wa,-mzarch"), + cppflags => add("-DB_ENDIAN"), bn_asm_src => sub { my $r=join(" ",@_); $r=~s|asm/s390x\.S|bn_asm.c|; $r; }, perlasm_scheme => "31", multilib => "/highgprs", @@ -808,32 +834,36 @@ my %targets = ( #### SPARC Linux setups "linux-sparcv8" => { inherit_from => [ "linux-generic32", asm("sparcv8_asm") ], - cflags => add("-mcpu=v8 -DB_ENDIAN -DBN_DIV2W"), + cflags => add("-mcpu=v8"), + cppflags => add("-DB_ENDIAN -DBN_DIV2W"), }, "linux-sparcv9" => { # it's a real mess with -mcpu=ultrasparc option under Linux, # but -Wa,-Av8plus should do the trick no matter what. inherit_from => [ "linux-generic32", asm("sparcv9_asm") ], - cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus -DB_ENDIAN -DBN_DIV2W"), + cflags => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"), + cppflags => add("-DB_ENDIAN -DBN_DIV2W"), }, "linux64-sparcv9" => { # GCC 3.1 is a requirement inherit_from => [ "linux-generic64", asm("sparcv9_asm") ], - cflags => add("-m64 -mcpu=ultrasparc -DB_ENDIAN"), + cflags => add("-m64 -mcpu=ultrasparc"), + cppflags => add("-DB_ENDIAN"), bn_ops => "BN_LLONG RC4_CHAR", multilib => "64", }, "linux-alpha-gcc" => { inherit_from => [ "linux-generic64", asm("alpha_asm") ], - cflags => add("-DL_ENDIAN"), + cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT_LONG", }, "linux-c64xplus" => { inherit_from => [ "BASE_unix" ], # TI_CGT_C6000_7.3.x is a requirement cc => "cl6x", - cflags => combine("--linux -ea=.s -eo=.o -mv6400+ -o2 -ox -ms -pden -DOPENSSL_SMALL_FOOTPRINT", + cflags => "--linux -ea=.s -eo=.o -mv6400+ -o2 -ox -ms -pden", + cppflags => combine("-DOPENSSL_SMALL_FOOTPRINT", threads("-D_REENTRANT")), bn_ops => "BN_LLONG", cpuid_asm_src => "c64xpluscpuid.s", @@ -959,7 +989,8 @@ my %targets = ( cflags => combine(picker(default => "-Wall", debug => "-O0 -g", release => "-O3"), - threads("-pthread -D_THREAD_SAFE -D_REENTRANT")), + threads("-pthread")), + cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"), ex_libs => add(threads("-pthread")), enable => add("devcryptoeng"), bn_ops => "BN_LLONG", @@ -976,8 +1007,8 @@ my %targets = ( "BSD-x86" => { inherit_from => [ "BSD-generic32", asm("x86_asm") ], - cflags => add(picker(default => "-DL_ENDIAN", - release => "-fomit-frame-pointer")), + cflags => add(picker(release => "-fomit-frame-pointer")), + cppflags => add("-DL_ENDIAN"), bn_ops => "BN_LLONG", shared_target => "bsd-shared", perlasm_scheme => "a.out", @@ -989,26 +1020,27 @@ my %targets = ( "BSD-sparcv8" => { inherit_from => [ "BSD-generic32", asm("sparcv8_asm") ], - cflags => add("-mcpu=v8 -DB_ENDIAN"), + cflags => add("-mcpu=v8"), + cppflags => add("-DB_ENDIAN"), }, "BSD-sparc64" => { # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it # simply *happens* to work around a compiler bug in gcc 3.3.3, # triggered by RIPEMD160 code. inherit_from => [ "BSD-generic64", asm("sparcv9_asm") ], - cflags => add("-DB_ENDIAN -DMD32_REG_T=int"), + cppflags => add("-DB_ENDIAN -DMD32_REG_T=int"), bn_ops => "BN_LLONG", }, "BSD-ia64" => { inherit_from => [ "BSD-generic64", asm("ia64_asm") ], - cflags => add_before("-DL_ENDIAN"), + cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT_LONG", }, "BSD-x86_64" => { inherit_from => [ "BSD-generic64", asm("x86_64_asm") ], - cflags => add_before("-DL_ENDIAN"), + cppflags => add("-DL_ENDIAN"), bn_ops => "SIXTY_FOUR_BIT_LONG", perlasm_scheme => "elf", }, @@ -1016,7 +1048,8 @@ my %targets = ( "bsdi-elf-gcc" => { inherit_from => [ "BASE_unix", asm("x86_elf_asm") ], cc => "gcc", - cflags => "-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -Wall", + cflags => "-fomit-frame-pointer -O3 -Wall", + cppflags => "-DPERL5 -DL_ENDIAN", ex_libs => add("-ldl"), bn_ops => "BN_LLONG", thread_scheme => "(unknown)", @@ -1047,7 +1080,8 @@ my %targets = ( "qnx4" => { inherit_from => [ "BASE_unix" ], cc => "cc", - cflags => "-DL_ENDIAN -DTERMIO", + cflags => "", + cppflags => "-DL_ENDIAN -DTERMIO", thread_scheme => "(unknown)", }, "QNX6" => { @@ -1062,7 +1096,8 @@ my %targets = ( "QNX6-i386" => { inherit_from => [ "BASE_unix", asm("x86_elf_asm") ], cc => "gcc", - cflags => "-DL_ENDIAN -O2 -Wall", + cflags => "-O2 -Wall", + cppflags => "-DL_ENDIAN", ex_libs => add("-lsocket"), dso_scheme => "dlfcn", shared_target => "bsd-gcc-shared", @@ -1084,24 +1119,24 @@ my %targets = ( "unixware-2.0" => { inherit_from => [ "BASE_unix" ], cc => "cc", - cflags => combine("-DFILIO_H -DNO_STRINGS_H", - threads("-Kthread")), + cflags => combine(threads("-Kthread")), + cppflags => "-DFILIO_H -DNO_STRINGS_H", ex_libs => add("-lsocket -lnsl -lresolv -lx"), thread_scheme => "uithreads", }, "unixware-2.1" => { inherit_from => [ "BASE_unix" ], cc => "cc", - cflags => combine("-O -DFILIO_H", - threads("-Kthread")), + cflags => combine("-O", threads("-Kthread")), + cppflags => "-DFILIO_H", ex_libs => add("-lsocket -lnsl -lresolv -lx"), thread_scheme => "uithreads", }, "unixware-7" => { inherit_from => [ "BASE_unix", asm("x86_elf_asm") ], cc => "cc", - cflags => combine("-O -DFILIO_H -Kalloca", - threads("-Kthread")), + cflags => combine("-O -Kalloca", threads("-Kthread")), + cppflags => "-DFILIO_H", ex_libs => add("-lsocket -lnsl"), thread_scheme => "uithreads", bn_ops => "BN_LLONG", @@ -1114,8 +1149,9 @@ my %targets = ( "unixware-7-gcc" => { inherit_from => [ "BASE_unix", asm("x86_elf_asm") ], cc => "gcc", - cflags => combine("-DL_ENDIAN -DFILIO_H -O3 -fomit-frame-pointer -Wall", - threads("-D_REENTRANT")), + cflags => combine("-O3 -fomit-frame-pointer -Wall"), + cppflags => add("-DL_ENDIAN -DFILIO_H", + threads("-D_REENTRANT")), ex_libs => add("-lsocket -lnsl"), bn_ops => "BN_LLONG", thread_scheme => "pthreads", @@ -1161,10 +1197,10 @@ my %targets = ( "aix-gcc" => { inherit_from => [ "BASE_unix", asm("ppc32_asm") ], cc => "gcc", - cflags => combine(picker(default => "-DB_ENDIAN", - debug => "-O0 -g", + cflags => combine(picker(debug => "-O0 -g", release => "-O"), threads("-pthread")), + cppflags => "-DB_ENDIAN", ex_libs => add(threads("-pthread")), sys_id => "AIX", bn_ops => "BN_LLONG RC4_CHAR", @@ -1179,10 +1215,11 @@ my %targets = ( "aix64-gcc" => { inherit_from => [ "BASE_unix", asm("ppc64_asm") ], cc => "gcc", - cflags => combine(picker(default => "-maix64 -DB_ENDIAN", + cflags => combine(picker(default => "-maix64", debug => "-O0 -g", release => "-O"), threads("-pthread")), + cppflags => "-DB_ENDIAN", ex_libs => add(threads("-pthread")), sys_id => "AIX", bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", @@ -1197,10 +1234,11 @@ my %targets = ( "aix-cc" => { inherit_from => [ "BASE_unix", asm("ppc32_asm") ], cc => "cc", - cflags => combine(picker(default => "-q32 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst", + cflags => combine(picker(default => "-q32 -qmaxmem=16384 -qro -qroconst", debug => "-O0 -g", release => "-O"), - threads("-qthreaded -D_THREAD_SAFE")), + threads("-qthreaded")), + cppflags => combine("-DB_ENDIAN", threads("-D_THREAD_SAFE")), sys_id => "AIX", bn_ops => "BN_LLONG RC4_CHAR", thread_scheme => "pthreads", @@ -1215,10 +1253,11 @@ my %targets = ( "aix64-cc" => { inherit_from => [ "BASE_unix", asm("ppc64_asm") ], cc => "cc", - cflags => combine(picker(default => "-q64 -DB_ENDIAN -qmaxmem=16384 -qro -qroconst", + cflags => combine(picker(default => "-q64 -qmaxmem=16384 -qro -qroconst", debug => "-O0 -g", release => "-O"), - threads("-qthreaded -D_THREAD_SAFE")), + threads("-qthreaded")), + cppflags => combine("-DB_ENDIAN", threads("-D_THREAD_SAFE")), sys_id => "AIX", bn_ops => "SIXTY_FOUR_BIT_LONG RC4_CHAR", thread_scheme => "pthreads", @@ -1235,7 +1274,8 @@ my %targets = ( "BS2000-OSD" => { inherit_from => [ "BASE_unix" ], cc => "c89", - cflags => "-O -XLLML -XLLMK -XL -DB_ENDIAN -DCHARSET_EBCDIC", + cflags => "-O -XLLML -XLLMK -XL", + cppflags => "-DB_ENDIAN -DCHARSET_EBCDIC", ex_libs => add("-lsocket -lnsl"), bn_ops => "THIRTY_TWO_BIT RC4_CHAR", thread_scheme => "(unknown)", @@ -1256,8 +1296,11 @@ my %targets = ( inherit_from => [ "BASE_Windows" ], template => 1, cc => "cl", - cflags => "-W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS", - defines => add(sub { my @defs = (); + cflags => "-W3 -wd4090 -Gs0 -GF -Gy -nologo", + defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN", + "L_ENDIAN", "_CRT_SECURE_NO_DEPRECATE", + "_WINSOCK_DEPRECATED_NO_WARNINGS", + sub { my @defs = (); unless ($disabled{"zlib-dynamic"}) { my $zlib = $withargs{zlib_lib} // "ZLIB1"; @@ -1266,7 +1309,7 @@ my %targets = ( 'LIBZ="' . $zlib . '"'); } return [ @defs ]; - }), + }), coutflag => "/Fo", lib_cflags => add("/Zi /Fdossl_static"), dso_cflags => "/Zi /Fddso", @@ -1281,17 +1324,18 @@ my %targets = ( "VC-noCE-common" => { inherit_from => [ "VC-common" ], template => 1, - cflags => add(picker(default => "-DUNICODE -D_UNICODE", - debug => + cflags => add(picker(debug => sub { ($disabled{shared} ? "" : "/MDd") - ." /Od -DDEBUG -D_DEBUG"; + ." /Od"; }, release => su |