From 460ac1c585198104cee0e0501cdccc16d20ab740 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 9 Feb 2008 16:05:55 +0100 Subject: Use mkinclude (makes the Makefile a bit shorter), use double-colon for phony makefile targets. (This used to be commit ea7d389bcc284d2e9eeff79bce5c285269099ad3) --- source4/rules.mk | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 source4/rules.mk (limited to 'source4/rules.mk') diff --git a/source4/rules.mk b/source4/rules.mk new file mode 100644 index 0000000000..0e2e2a7c75 --- /dev/null +++ b/source4/rules.mk @@ -0,0 +1,134 @@ +include/config.h: + @echo "include/config.h not present" + @echo "You need to rerun ./autogen.sh and ./configure" + @/bin/false + +$(srcdir)/version.h: $(srcdir)/VERSION + @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/ + +regen_version:: + @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/ + +clean_pch:: + @echo "Removing precompiled headers" + @-rm -f include/includes.h.gch + +pch:: clean_pch include/includes.h.gch + +clean:: clean_pch + @echo Removing objects + @-find . -name '*.o' -exec rm -f '{}' \; + @echo Removing hostcc objects + @-find . -name '*.ho' -exec rm -f '{}' \; + @echo Removing binaries + @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS) + @echo Removing libraries + @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES) + @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) + @echo Removing modules + @-rm -f bin/modules/*/*.$(SHLIBEXT) + @-rm -f bin/*_init_module.c + @echo Removing dummy targets + @-rm -f bin/.*_* + @echo Removing generated files + @-rm -f bin/*_init_module.c + @-rm -rf librpc/gen_* + @echo Removing proto headers + @-rm -f $(PROTO_HEADERS) + +distclean:: clean + -rm -f include/config.h include/config_tmp.h include/build.h + -rm -f Makefile + -rm -f config.status + -rm -f config.log config.cache + -rm -f config.pm config.mk + -rm -f $(PC_FILES) + +removebackup:: + -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~ + +realdistclean:: distclean removebackup + -rm -f include/config_tmp.h.in + -rm -f version.h + -rm -f configure + -rm -f $(MANPAGES) + +check:: test + +unused_macros: + $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort + +############################################################################### +# File types +############################################################################### + +.SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .$(SHLIBEXT) .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd + +.c.d: + @echo "Generating dependencies for $<" + @$(DEPENDS) + +.c.hd: + @echo "Generating host-compiler dependencies for $<" + @$(HDEPENDS) + +include/includes.d: include/includes.h + @echo "Generating dependencies for $<" + @$(PCHDEPENDS) + +.c.o: + @if test -n "$(CC_CHECKER)"; then \ + echo "Checking $< with '$(CC_CHECKER)'"; \ + $(CHECK) ; \ + fi + @echo "Compiling $<" + @-mkdir -p `dirname $@` + @$(COMPILE) && exit 0 ; \ + echo "The following command failed:" 1>&2;\ + echo "$(COMPILE)" 1>&2;\ + $(COMPILE) >/dev/null 2>&1 + +.c.ho: + @echo "Compiling $< with host compiler" + @-mkdir -p `dirname $@` + @$(HCOMPILE) && exit 0;\ + echo "The following command failed:" 1>&2;\ + echo "$(HCOMPILE)" 1>&2;\ + $(HCOMPILE) >/dev/null 2>&1 + +.h.h.gch: + @echo "Precompiling $<" + @$(PCHCOMPILE) + +.y.c: + @echo "Building $< with $(YACC)" + @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@" + +.l.c: + @echo "Building $< with $(LEX)" + @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@" + +DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl + +.1.xml.1: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.3.xml.3: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.5.xml.5: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.7.xml.7: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +.8.xml.8: + $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \ + include/includes.d + +dist:: idl_full manpages configure distclean + +configure: + ./autogen.sh -- cgit