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) $(TALLOC_LDFLAGS)
-FINAL_LIBFIPS_LDFLAGS = $(LDFLAGS) -ldl
-FINAL_FIPS_LINKER = CC
-ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
-FINAL_FIPS_LDFLAGS += $(CONFIGURE_LDFLAGS)
+# Smash together user's values with values from Makefile.config
+FIPS_CFLAGS = -DFIPS_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(TALLOC_CFLAGS) $(LIBELF_CFLAGS) $(extra_cflags)
+FIPS_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(TALLOC_LDFLAGS) $(LIBELF_LDFLAGS)
+
+LIBFIPS_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(GL_CFLAGS) $(EGL_CFLAGS) $(extra_cflags)
+LIBFIPS_LDFLAGS = $(LDFLAGS) -ldl
+
+FIPS_LINKER = CC
+
+ALL_TARGETS = fips
+
+ifeq ($(COMPILER_SUPPORTS_32),Yes)
+ALL_TARGETS += libfips-32.so
+endif
+
+ifeq ($(COMPILER_SUPPORTS_64),Yes)
+ALL_TARGETS += libfips-64.so
endif
.PHONY: all
-all: fips libfips.so
+all: $(ALL_TARGETS)
ifeq ($(MAKECMDGOALS),)
ifeq ($(shell cat .first-build-message 2>/dev/null),)
endif
endif
-.PHONY: test
-test:
- @echo "FIXME: Should consider adding a test suite here."
-
# The user has not set any verbosity, default to quiet mode and inform the
# user how to enable verbose compiles.
ifeq ($(V),)
# Otherwise, print the full command line.
quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
+%-32.o: %.c $(global_deps)
+ @mkdir -p .deps/$(@D)
+ $(call quiet,CC $(CFLAGS) -m32) -c $(LIBFIPS_CFLAGS) -m32 $< -o $@ -MD -MP -MF .deps/$*.d
+
+%-64.o: %.c $(global_deps)
+ @mkdir -p .deps/$(@D)
+ $(call quiet,CC $(CFLAGS) -m64) -c $(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 $(FIPS_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
.PHONY : clean
clean:
fips_modules = $(fips_srcs:.c=.o)
fips: $(fips_modules)
- $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $(FINAL_CFLAGS) $^ $(FINAL_FIPS_LDFLAGS) -o $@
+ $(call quiet,$(FIPS_LINKER) $(CFLAGS)) $(FIPS_CFLAGS) $^ $(FIPS_LDFLAGS) -o $@
# GL-wrapper library, libfips
-LIBRARY_LINK_FLAGS = -shared -Wl,--version-script=libfips.sym,--no-undefined
+LIBRARY_LINK_FLAGS = -shared -Wl,--version-script=libfips.sym
extra_cflags += -I$(srcdir) -fPIC
libfips_srcs = \
- glxwrap.c
+ dlwrap.c \
+ fips-dispatch.c \
+ fips-dispatch-gl.c \
+ glwrap.c \
+ glxwrap.c \
+ metrics.c
+
+ifeq ($(HAVE_EGL),Yes)
+libfips_srcs += eglwrap.c
+endif
+
+libfips.sym: extract-wrapped-symbols $(libfips_srcs)
+ $(call quiet,extract-wrapped-symbols) ./extract-wrapped-symbols $(libfips_srcs) > $@
+
+libfips_32_modules = $(libfips_srcs:.c=-32.o)
+
+libfips_64_modules = $(libfips_srcs:.c=-64.o)
-libfips_modules = $(libfips_srcs:.c=.o)
+libfips-32.so: $(libfips_32_modules) libfips.sym
+ $(call quiet,$(FIPS_LINKER) $(CFLAGS) -m32) -o $@ $(LIBFIPS_CFLAGS) -m32 $(libfips_32_modules) $(LIBRARY_LINK_FLAGS) $(LIBFIPS_LDFLAGS)
-libfips.so: $(libfips_modules) libfips.sym
- $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $(FINAL_CFLAGS) $(libfips_modules) $(FINAL_LIBFIPS_LDFLAGS) $(LIBRARY_LINK_FLAGS) -o $@
+libfips-64.so: $(libfips_64_modules) libfips.sym
+ $(call quiet,$(FIPS_LINKER) $(CFLAGS) -m64) -o $@ $(LIBFIPS_CFLAGS) -m64 $(libfips_64_modules) $(LIBRARY_LINK_FLAGS) $(LIBFIPS_LDFLAGS)
.PHONY: install
install: all
mkdir -p $(DESTDIR)$(bindir)
install fips $(DESTDIR)$(bindir)/fips
mkdir -p $(DESTDIR)$(libdir)/fips
- install -m0644 libfips.so $(DESTDIR)$(libdir)/fips/libfips.so
+ install -m0644 libfips-32.so $(DESTDIR)$(libdir)/fips/libfips-32.so
+ install -m0644 libfips-64.so $(DESTDIR)$(libdir)/fips/libfips-64.so
ifeq ($(MAKECMDGOALS), install)
@echo ""
@echo "Fips is now installed to $(DESTDIR)$(prefix)"
endif
SRCS := $(SRCS) $(fips_srcs) $(libfips_srcs)
-CLEAN := $(CLEAN) fips $(fips_modules) $(libfips_modules)
+CLEAN := $(CLEAN) fips $(fips_modules) $(libfips_32_modules) $(libfips_64_modules) libfips.sym
DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config