]> git.cworth.org Git - fips/commitdiff
configure: Fully separate CFLAGS/LDFLAGS between fips and libfips
authorCarl Worth <cworth@cworth.org>
Fri, 14 Jun 2013 06:29:07 +0000 (23:29 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 14 Jun 2013 06:29:07 +0000 (23:29 -0700)
The top-level program and the underlying library have fundamentally
different requirements. For example, the top-level program needs to
link against libtalloc and libelf but the library does not.

Previously, the necessary flags for both were mixed together in
CONFIGURE_CFLAGS and CONFIGURE_LDFLAGS. This caused the library to
unnecessarily link against libtalloc and libelf, (which in turn caused
problems since the library is compiled as both 32-bit and 64-bit but
the system may not provide both 32- and 64-bit versions of these
libraries).

By splitting things up into separate FIPS_LDFLAGS vs. LIBFIPS_LDFLAGS,
etc. we can keep the dependencies down to what is really required and
eliminate several sprious failure cases.

Makefile.local
configure

index 179700ee8da9bceff4062acdf93eb00fc4ba7a6f..79147188ac145e50f95dc24bb3bcc4039618fc70 100644 (file)
@@ -3,9 +3,12 @@
 include Makefile.release
 
 # Smash together user's values with our extra values
-FINAL_CFLAGS = -DFIPS_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
-FINAL_FIPS_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
-FINAL_LIBFIPS_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS) -ldl
+FINAL_FIPS_CFLAGS = -DFIPS_VERSION=$(VERSION) $(CFLAGS) $(FIPS_CFLAGS) $(extra_cflags)
+FINAL_FIPS_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(FIPS_LDFLAGS)
+
+FINAL_LIBFIPS_CFLAGS = $(CFLAGS) $(LIBFIPS_CFLAGS) $(extra_cflags)
+FINAL_LIBFIPS_LDFLAGS = $(LDFLAGS) $(LIBFIPS_LDFLAGS) -ldl
+
 FINAL_FIPS_LINKER = CC
 
 ALL_TARGETS = fips
@@ -55,15 +58,15 @@ quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
 
 %-32.o: %.c $(global_deps)
        @mkdir -p .deps/$(@D)
-       $(call quiet,CC $(CFLAGS) -m32) -c $(FINAL_CFLAGS) -m32 $< -o $@ -MD -MP -MF .deps/$*.d
+       $(call quiet,CC $(CFLAGS) -m32) -c $(FINAL_LIBFIPS_CFLAGS) -m32 $< -o $@ -MD -MP -MF .deps/$*.d
 
 %-64.o: %.c $(global_deps)
        @mkdir -p .deps/$(@D)
-       $(call quiet,CC $(CFLAGS) -m64) -c $(FINAL_CFLAGS) -m64 $< -o $@ -MD -MP -MF .deps/$*.d
+       $(call quiet,CC $(CFLAGS) -m64) -c $(FINAL_LIBFIPS_CFLAGS) -m64 $< -o $@ -MD -MP -MF .deps/$*.d
 
 %.o: %.c $(global_deps)
        @mkdir -p .deps/$(@D)
-       $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
+       $(call quiet,CC $(CFLAGS)) -c $(FINAL_FIPS_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
 
 .PHONY : clean
 clean:
@@ -82,7 +85,7 @@ fips_srcs = \
 fips_modules = $(fips_srcs:.c=.o)
 
 fips: $(fips_modules)
-       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $(FINAL_CFLAGS) $^ $(FINAL_FIPS_LDFLAGS) -o $@
+       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $(FINAL_FIPS_CFLAGS) $^ $(FINAL_FIPS_LDFLAGS) -o $@
 
 # GL-wrapper library, libfips
 LIBRARY_LINK_FLAGS = -shared -Wl,--version-script=libfips.sym
@@ -107,10 +110,10 @@ libfips_32_modules = $(libfips_srcs:.c=-32.o)
 libfips_64_modules = $(libfips_srcs:.c=-64.o)
 
 libfips-32.so: $(libfips_32_modules) libfips.sym
-       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS) -m32) -o $@ $(FINAL_CFLAGS) -m32 $(libfips_32_modules)  $(LIBRARY_LINK_FLAGS) $(FINAL_LIBFIPS_LDFLAGS)
+       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS) -m32) -o $@ $(FINAL_LIBFIPS_CFLAGS) -m32 $(libfips_32_modules)  $(LIBRARY_LINK_FLAGS) $(FINAL_LIBFIPS_LDFLAGS)
 
 libfips-64.so: $(libfips_64_modules) libfips.sym
-       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS) -m64) -o $@ $(FINAL_CFLAGS) -m64 $(libfips_64_modules) $(LIBRARY_LINK_FLAGS) $(FINAL_LIBFIPS_LDFLAGS)
+       $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS) -m64) -o $@ $(FINAL_LIBFIPS_CFLAGS) -m64 $(libfips_64_modules) $(LIBRARY_LINK_FLAGS) $(FINAL_LIBFIPS_LDFLAGS)
 
 .PHONY: install
 install: all
index c584c93a349ad7023f58f4112bc942d4d734c6f8..3a6a597fabdc05a7d2a4e3856297c20ce328917f 100755 (executable)
--- a/configure
+++ b/configure
@@ -538,9 +538,13 @@ EGL_CFLAGS = ${egl_cflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
 
-# Combined flags for compiling and linking against all of the above
-CONFIGURE_CFLAGS = \$(TALLOC_CFLAGS) \$(LIBELF_CFLAGS) \$(GL_CFLAGS) \$(EGL_CFLAGS)
-CONFIGURE_LDFLAGS = \$(TALLOC_LDFLAGS) \$(LIBELF_LDFLAGS)
+# Flags needed to compile the fips binary
+FIPS_CFLAGS = \$(WARN_CFLAGS) \$(TALLOC_CFLAGS) \$(LIBELF_CFLAGS)
+FIPS_LDFLAGS = \$(WARN_CFLAGS) \$(TALLOC_LDFLAGS) \$(LIBELF_LDFLAGS)
+
+# Flags needed to compile the libfips libraries
+LIBFIPS_CFLAGS = \$(GL_CFLAGS) \$(EGL_CFLAGS)
+LIBFIPS_LDFLAGS =
 EOF
 
 # construct config.h