X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=Makefile.local;h=817a0a3fb49d3fe0fa7df6918855b0831a3901f5;hb=dfb96c9b64def8674a38dda2bc2276d4e2cdd58e;hp=3dd793271a02ae49775e8181d853ba534f439c46;hpb=b32aa136d3e51a250e58c0fc28162b5e5fd52f67;p=fips diff --git a/Makefile.local b/Makefile.local index 3dd7932..817a0a3 100644 --- a/Makefile.local +++ b/Makefile.local @@ -2,14 +2,27 @@ 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_LINKER = CC +# 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-64.so libfips-32.so +all: $(ALL_TARGETS) ifeq ($(MAKECMDGOALS),) ifeq ($(shell cat .first-build-message 2>/dev/null),) @@ -26,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),) @@ -45,15 +54,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 $(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 $(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: @@ -67,38 +76,58 @@ distclean: clean fips_srcs = \ execute.c \ - fips.c + fips.c \ + xmalloc.c 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 + 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,$(FINAL_FIPS_LINKER) $(CFLAGS) -m32) $(FINAL_CFLAGS) -m32 $(libfips_32_modules) $(FINAL_LIBFIPS_LDFLAGS) $(LIBRARY_LINK_FLAGS) -o $@ + $(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,$(FINAL_FIPS_LINKER) $(CFLAGS) -m64) $(FINAL_CFLAGS) -m64 $(libfips_64_modules) $(FINAL_LIBFIPS_LDFLAGS) $(LIBRARY_LINK_FLAGS) -o $@ + $(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 +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)" @@ -106,11 +135,10 @@ ifeq ($(MAKECMDGOALS), install) endif SRCS := $(SRCS) $(fips_srcs) $(libfips_srcs) -CLEAN := $(CLEAN) fips $(fips_modules) $(libfips_32_modules) $(libfips_64_modules) +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)