# -*- makefile -*- include Makefile.release # 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: $(ALL_TARGETS) ifeq ($(MAKECMDGOALS),) ifeq ($(shell cat .first-build-message 2>/dev/null),) @FIPS_FIRST_BUILD=1 $(MAKE) --no-print-directory all @echo "" @echo "Compilation of fips is now complete. You can install fips with:" @echo "" @echo " make install" @echo "" @echo "Note that depending on the prefix to which you are installing" @echo "you may need root permission (such as \"sudo make install\")." @echo "See \"./configure --help\" for help on setting an alternate prefix." @echo Printed > .first-build-message endif endif # The user has not set any verbosity, default to quiet mode and inform the # user how to enable verbose compiles. ifeq ($(V),) quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n" quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//')) endif # The user has explicitly enabled quiet compilation. ifeq ($(V),0) quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//')) 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 $(FIPS_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d .PHONY : clean clean: rm -rf $(CLEAN); rm -rf .deps .PHONY: distclean distclean: clean rm -rf $(DISTCLEAN) # Main program, fips fips_srcs = \ execute.c \ fips.c \ xmalloc.c fips_modules = $(fips_srcs:.c=.o) fips: $(fips_modules) $(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)$(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) $(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) -include $(DEPS)