]> git.cworth.org Git - fips/blob - Makefile.local
configure: Tighten up the text on a couple of messages
[fips] / Makefile.local
1 # -*- makefile -*-
2
3 include Makefile.release
4
5 # Smash together user's values with our extra values
6 FINAL_CFLAGS = -DFIPS_VERSION=$(VERSION) $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
7 FINAL_FIPS_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
8 FINAL_LIBFIPS_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS) -ldl
9 FINAL_FIPS_LINKER = CC
10
11 .PHONY: all
12 all: fips libfips-64.so libfips-32.so
13
14 ifeq ($(MAKECMDGOALS),)
15 ifeq ($(shell cat .first-build-message 2>/dev/null),)
16         @FIPS_FIRST_BUILD=1 $(MAKE) --no-print-directory all
17         @echo ""
18         @echo "Compilation of fips is now complete. You can install fips with:"
19         @echo ""
20         @echo " make install"
21         @echo ""
22         @echo "Note that depending on the prefix to which you are installing"
23         @echo "you may need root permission (such as \"sudo make install\")."
24         @echo "See \"./configure --help\" for help on setting an alternate prefix."
25         @echo Printed > .first-build-message
26 endif
27 endif
28
29 .PHONY: test
30 test:
31         @echo "FIXME: Should consider adding a test suite here."
32
33 # The user has not set any verbosity, default to quiet mode and inform the
34 # user how to enable verbose compiles.
35 ifeq ($(V),)
36 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
37 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
38 endif
39 # The user has explicitly enabled quiet compilation.
40 ifeq ($(V),0)
41 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
42 endif
43 # Otherwise, print the full command line.
44 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
45
46 %-32.o: %.c $(global_deps)
47         @mkdir -p .deps/$(@D)
48         $(call quiet,CC $(CFLAGS) -m32) -c $(FINAL_CFLAGS) -m32 $< -o $@ -MD -MP -MF .deps/$*.d
49
50 %-64.o: %.c $(global_deps)
51         @mkdir -p .deps/$(@D)
52         $(call quiet,CC $(CFLAGS) -m64) -c $(FINAL_CFLAGS) -m64 $< -o $@ -MD -MP -MF .deps/$*.d
53
54 %.o: %.c $(global_deps)
55         @mkdir -p .deps/$(@D)
56         $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
57
58 .PHONY : clean
59 clean:
60         rm -rf $(CLEAN); rm -rf .deps
61
62 .PHONY: distclean
63 distclean: clean
64         rm -rf $(DISTCLEAN)
65
66 # Main program, fips
67
68 fips_srcs = \
69         execute.c \
70         fips.c
71
72 fips_modules = $(fips_srcs:.c=.o)
73
74 fips: $(fips_modules)
75         $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $(FINAL_CFLAGS) $^ $(FINAL_FIPS_LDFLAGS) -o $@
76
77 # GL-wrapper library, libfips
78 LIBRARY_LINK_FLAGS = -shared -Wl,--version-script=libfips.sym
79
80 extra_cflags += -I$(srcdir) -fPIC
81
82 libfips_srcs = \
83         dlwrap.c \
84         glwrap.c \
85         glxwrap.c \
86         metrics.c
87
88 ifeq ($(HAVE_EGL),Yes)
89 libfips_srcs += eglwrap.c
90 endif
91
92 libfips.sym: extract-wrapped-symbols $(libfips_srcs)
93         $(call quiet,extract-wrapped-symbols) ./extract-wrapped-symbols $(libfips_srcs) > $@
94
95 libfips_32_modules = $(libfips_srcs:.c=-32.o)
96
97 libfips_64_modules = $(libfips_srcs:.c=-64.o)
98
99 libfips-32.so: $(libfips_32_modules) libfips.sym
100         $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS) -m32) -o $@ $(FINAL_CFLAGS) -m32 $(libfips_32_modules)  $(LIBRARY_LINK_FLAGS) $(FINAL_LIBFIPS_LDFLAGS)
101
102 libfips-64.so: $(libfips_64_modules) libfips.sym
103         $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS) -m64) -o $@ $(FINAL_CFLAGS) -m64 $(libfips_64_modules) $(LIBRARY_LINK_FLAGS) $(FINAL_LIBFIPS_LDFLAGS)
104
105 .PHONY: install
106 install: all
107         mkdir -p $(DESTDIR)$(bindir)
108         install fips $(DESTDIR)$(bindir)/fips
109         mkdir -p $(DESTDIR)$(libdir)/fips
110         install -m0644 libfips-32.so $(DESTDIR)$(libdir)/fips/libfips-32.so
111         install -m0644 libfips-64.so $(DESTDIR)$(libdir)/fips/libfips-64.so
112 ifeq ($(MAKECMDGOALS), install)
113         @echo ""
114         @echo "Fips is now installed to $(DESTDIR)$(prefix)"
115         @echo ""
116 endif
117
118 SRCS  := $(SRCS) $(fips_srcs) $(libfips_srcs)
119 CLEAN := $(CLEAN) fips $(fips_modules) $(libfips_32_modules) $(libfips_64_modules) libfips.sym
120
121 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
122
123 DEPS := $(SRCS:%.c=.deps/%.d)
124 DEPS := $(DEPS:%.cc=.deps/%.d)
125
126 -include $(DEPS)