Add context pointer to secrets functions.
[jelmer/samba4-debian.git] / source / rules.mk
index 0e2e2a7c75e88d91d9f35c78919412b85214afcb..5f91f8132e98cab1d9b22f3d22e8b3f8125747d1 100644 (file)
@@ -1,3 +1,31 @@
+# Dependencies command
+DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \
+    $(CFLAGS) $(CPPFLAGS) $< -o $@
+# Dependencies for host objects
+HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \
+    $(HOSTCC_FLAGS) $(CPPFLAGS) $< -o $@
+# Dependencies for precompiled headers
+PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \
+    $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+# Run a static analysis checker
+CHECK = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) $(CPPLAGS) -c $< -o $@
+
+# Run the configured compiler
+COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \
+                 $(CPPFLAGS) \
+                 -c $< -o $@
+
+# Run the compiler for the build host
+HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@
+
+# Precompile headers
+PCHCOMPILE = @$(CC) -Ilib/replace \
+    $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@
+
+# Partial linking
+PARTLINK = @$(PROG_LD) -r
+
 include/config.h:
        @echo "include/config.h not present"
        @echo "You need to rerun ./autogen.sh and ./configure"
@@ -24,7 +52,7 @@ clean:: clean_pch
        @-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)
+       @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
        @echo Removing modules
        @-rm -f bin/modules/*/*.$(SHLIBEXT)
        @-rm -f bin/*_init_module.c
@@ -38,7 +66,7 @@ clean:: clean_pch
 
 distclean:: clean
        -rm -f include/config.h include/config_tmp.h include/build.h
-       -rm -f Makefile 
+       -rm -f data.mk
        -rm -f config.status
        -rm -f config.log config.cache
        -rm -f config.pm config.mk
@@ -58,6 +86,13 @@ check:: test
 unused_macros:
        $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
 
+# Create a static library
+%.a:
+       @echo Linking $@
+       @rm -f $@
+       @mkdir -p $(@D)
+       @$(STLD) $(STLD_FLAGS) $@ $^
+
 ###############################################################################
 # File types
 ###############################################################################
@@ -85,9 +120,11 @@ include/includes.d: include/includes.h
        @-mkdir -p `dirname $@`
        @$(COMPILE) && exit 0 ; \
                echo "The following command failed:" 1>&2;\
-               echo "$(COMPILE)" 1>&2;\
                $(COMPILE) >/dev/null 2>&1
 
+
+#              echo "$(COMPILE)" 1>&2;\
+
 .c.ho:
        @echo "Compiling $< with host compiler"
        @-mkdir -p `dirname $@`
@@ -125,10 +162,30 @@ DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpage
 .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
+
+showflags::
+       @echo 'Samba will be compiled with flags:'
+       @echo '  CPP        = $(CPP)'
+       @echo '  CPPFLAGS   = $(CPPFLAGS)'
+       @echo '  CC         = $(CC)'
+       @echo '  CFLAGS     = $(CFLAGS)'
+       @echo '  PICFLAG    = $(PICFLAG)'
+       @echo '  BNLD       = $(BNLD)'
+       @echo '  BNLD_FLAGS = $(BNLD_FLAGS)'
+       @echo '  STLD       = $(STLD)'
+       @echo '  STLD_FLAGS = $(STLD_FLAGS)'
+       @echo '  SHLD       = $(SHLD)'
+       @echo '  SHLD_FLAGS = $(SHLD_FLAGS)'
+       @echo '  MDLD       = $(MDLD)'
+       @echo '  MDLD_FLAGS = $(MDLD_FLAGS)'
+       @echo '  SHLIBEXT   = $(SHLIBEXT)'
+
+etags:
+       etags `find $(srcdir) -name "*.[ch]"`
+
+ctags:
+       ctags `find $(srcdir) -name "*.[ch]"`