X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=Makefile.local;h=817a0a3fb49d3fe0fa7df6918855b0831a3901f5;hb=47739542f4ffba033bb70a8f58d1a056889f717e;hp=2b09150f9d8222f3c64b37d4cbd2fbe705a1c418;hpb=e0072d01d5353d23d2e344c5bbb40ba0c8cb4241;p=fips diff --git a/Makefile.local b/Makefile.local index 2b09150..817a0a3 100644 --- a/Makefile.local +++ b/Makefile.local @@ -2,19 +2,28 @@ 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_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 ($(LIBDIR_IN_LDCONFIG),0) -FINAL_FIPS_LDFLAGS += $(RPATH_LDFLAGS) + +ifeq ($(COMPILER_SUPPORTS_64),Yes) +ALL_TARGETS += libfips-64.so endif .PHONY: all -all: fips +all: $(ALL_TARGETS) + ifeq ($(MAKECMDGOALS),) ifeq ($(shell cat .first-build-message 2>/dev/null),) @FIPS_FIRST_BUILD=1 $(MAKE) --no-print-directory all @@ -30,10 +39,6 @@ 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),) @@ -47,9 +52,17 @@ endif # 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: @@ -59,30 +72,73 @@ clean: distclean: clean rm -rf $(DISTCLEAN) +# Main program, fips + fips_srcs = \ - fips.c + execute.c \ + fips.c \ + xmalloc.c fips_modules = $(fips_srcs:.c=.o) fips: $(fips_modules) - $(call quiet,$(FINAL_FIPS_LINKER) $(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 + +extra_cflags += -I$(srcdir) -fPIC + +libfips_srcs = \ + context.c \ + dlwrap.c \ + fips-dispatch.c \ + fips-dispatch-gl.c \ + glwrap.c \ + glxwrap.c \ + metrics.c \ + metrics-info.c \ + xmalloc.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-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-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)$(prefix)/bin/ - install fips $(DESTDIR)$(prefix)/bin/fips + mkdir -p $(DESTDIR)$(bindir) + install fips $(DESTDIR)$(bindir)/fips + mkdir -p $(DESTDIR)$(libdir)/fips +ifeq ($(COMPILER_SUPPORTS_32), Yes) + install -m0644 libfips-32.so $(DESTDIR)$(libdir)/fips/libfips-32.so +endif +ifeq ($(COMPILER_SUPPORTS_64), Yes) + install -m0644 libfips-64.so $(DESTDIR)$(libdir)/fips/libfips-64.so +endif ifeq ($(MAKECMDGOALS), install) @echo "" @echo "Fips is now installed to $(DESTDIR)$(prefix)" @echo "" endif -SRCS := $(SRCS) $(fips_srcs) -CLEAN := $(CLEAN) fips $(fips_modules) +SRCS := $(SRCS) $(fips_srcs) $(libfips_srcs) +CLEAN := $(CLEAN) fips $(fips_modules) $(libfips_32_modules) $(libfips_64_modules) libfips.sym DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config DEPS := $(SRCS:%.c=.deps/%.d) -DEPS := $(DEPS:%.cc=.deps/%.d) -include $(DEPS)