]> git.cworth.org Git - fips/blob - Makefile.local
Add the ability to execute a program.
[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) $(TALLOC_LDFLAGS)
8 FINAL_FIPS_LINKER = CC
9 ifneq ($(LINKER_RESOLVES_LIBRARY_DEPENDENCIES),1)
10 FINAL_FIPS_LDFLAGS += $(CONFIGURE_LDFLAGS)
11 endif
12 ifeq ($(LIBDIR_IN_LDCONFIG),0)
13 FINAL_FIPS_LDFLAGS += $(RPATH_LDFLAGS)
14 endif
15
16 .PHONY: all
17 all: fips
18 ifeq ($(MAKECMDGOALS),)
19 ifeq ($(shell cat .first-build-message 2>/dev/null),)
20         @FIPS_FIRST_BUILD=1 $(MAKE) --no-print-directory all
21         @echo ""
22         @echo "Compilation of fips is now complete. You can install fips with:"
23         @echo ""
24         @echo " make install"
25         @echo ""
26         @echo "Note that depending on the prefix to which you are installing"
27         @echo "you may need root permission (such as \"sudo make install\")."
28         @echo "See \"./configure --help\" for help on setting an alternate prefix."
29         @echo Printed > .first-build-message
30 endif
31 endif
32
33 .PHONY: test
34 test:
35         @echo "FIXME: Should consider adding a test suite here."
36
37 # The user has not set any verbosity, default to quiet mode and inform the
38 # user how to enable verbose compiles.
39 ifeq ($(V),)
40 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
41 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
42 endif
43 # The user has explicitly enabled quiet compilation.
44 ifeq ($(V),0)
45 quiet = @printf "$1 $@\n"; $($(shell echo $1 | sed -e s'/ .*//'))
46 endif
47 # Otherwise, print the full command line.
48 quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
49
50 %.o: %.c $(global_deps)
51         @mkdir -p .deps/$(@D)
52         $(call quiet,CC $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
53
54 .PHONY : clean
55 clean:
56         rm -rf $(CLEAN); rm -rf .deps
57
58 .PHONY: distclean
59 distclean: clean
60         rm -rf $(DISTCLEAN)
61
62 fips_srcs = \
63         execute.c \
64         fips.c
65
66 fips_modules = $(fips_srcs:.c=.o)
67
68 fips: $(fips_modules)
69         $(call quiet,$(FINAL_FIPS_LINKER) $(CFLAGS)) $^ $(FINAL_FIPS_LDFLAGS) -o $@
70
71 .PHONY: install
72 install: all
73         mkdir -p $(DESTDIR)$(prefix)/bin/
74         install fips $(DESTDIR)$(prefix)/bin/fips
75 ifeq ($(MAKECMDGOALS), install)
76         @echo ""
77         @echo "Fips is now installed to $(DESTDIR)$(prefix)"
78         @echo ""
79 endif
80
81 SRCS  := $(SRCS) $(fips_srcs)
82 CLEAN := $(CLEAN) fips $(fips_modules)
83
84 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config
85
86 DEPS := $(SRCS:%.c=.deps/%.d)
87 DEPS := $(DEPS:%.cc=.deps/%.d)
88
89 -include $(DEPS)