test for .git dir with -d not -e; more portable
[exim.git] / src / OS / Makefile-Base
index cb2359f284bc63802014b02e9adac0f8852db8dc..deb0e44f15decdb4cb3f9bcdc166bebf9104d9d0 100644 (file)
@@ -32,7 +32,7 @@ FE       = $(FULLECHO)
 # up-to-date. Then the os-specific source files and the C configuration file
 # are set up, and finally it goes to the main Exim target.
 
 # up-to-date. Then the os-specific source files and the C configuration file
 # are set up, and finally it goes to the main Exim target.
 
-all:    $(EDITME) checklocalmake Makefile os.h os.c config.h allexim
+all:    $(EDITME) checklocalmake Makefile os.h os.c config.h version.h allexim
 
 checklocalmake:
        @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
 
 checklocalmake:
        @if $(SHELL) $(SCRIPTS)/newer $(EDITME)-$(OSTYPE) $(EDITME) || \
@@ -317,13 +317,7 @@ OBJ_EXIM = acl.o child.o crypt16.o daemon.o dbfn.o debug.o deliver.o \
 
 exim:   lookups/lookups.a auths/auths.a pdkim/pdkim.a \
         routers/routers.a transports/transports.a \
 
 exim:   lookups/lookups.a auths/auths.a pdkim/pdkim.a \
         routers/routers.a transports/transports.a \
-        $(OBJ_EXIM) version.c
-       @echo " "
-       awk '{ print ($$1+1) }' cnumber.h > cnumber.temp
-       rm -f cnumber.h; mv cnumber.temp cnumber.h
-       @echo "$(CC) version.c"
-       $(FE)$(CC) -c $(CFLAGS) $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) version.c
-       rm -f exim
+        $(OBJ_EXIM) version.o
        @echo "$(LNCC) -o exim"
        $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
          routers/routers.a transports/transports.a lookups/lookups.a \
        @echo "$(LNCC) -o exim"
        $(FE)$(PURIFY) $(LNCC) -o exim $(LFLAGS) $(OBJ_EXIM) version.o \
          routers/routers.a transports/transports.a lookups/lookups.a \
@@ -459,6 +453,13 @@ PHDRS = ../config.h ../dbfunctions.h ../dbstuff.h ../exim.h ../functions.h ../gl
 .c.o:;  @echo "$(CC) $*.c"
        $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
 
 .c.o:;  @echo "$(CC) $*.c"
        $(FE)$(CC) -c $(CFLAGS) -I. $(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $*.c
 
+# Update Exim's version information and build the version object.
+
+version.h::
+       @../scripts/reversion
+
+version.o: $(HDRS) cnumber.h version.h version.c
+
 # This is the dummy module for use by test compiles of individual modules. It
 # contains functions such as log_write() that may be called from bits of Exim
 # in the tested code.
 # This is the dummy module for use by test compiles of individual modules. It
 # contains functions such as log_write() that may be called from bits of Exim
 # in the tested code.
@@ -637,44 +638,44 @@ $(MONBIN): $(HDRS)
 
 # The lookups library.
 
 
 # The lookups library.
 
-buildlookups lookups/lookups.a: config.h
-        @cd lookups; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
-          CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" \
-          FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
-          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"; \
-        echo " "
+buildlookups lookups/lookups.a: config.h version.h
+        @cd lookups && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+          CFLAGS_DYNAMIC="$(CFLAGS_DYNAMIC)" HDRS="../version.h $(PHDRS)" \
+          FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" \
+          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE) $(LOOKUP_INCLUDE)"
+        @echo " "
 
 # The routers library.
 
 buildrouters routers/routers.a: config.h
 
 # The routers library.
 
 buildrouters routers/routers.a: config.h
-        @cd routers; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+        @cd routers && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
-          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
-        echo " "
+          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
+        @echo " "
 
 # The transports library.
 
 buildtransports transports/transports.a: config.h
 
 # The transports library.
 
 buildtransports transports/transports.a: config.h
-        @cd transports; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+        @cd transports && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
-          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
-        echo " "
+          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
+        @echo " "
 
 # The library of authorization modules
 
 buildauths auths/auths.a: config.h
 
 # The library of authorization modules
 
 buildauths auths/auths.a: config.h
-        @cd auths; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+        @cd auths && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
-          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
-        echo " "
+          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
+        @echo " "
 
 # The PDKIM library
 
 buildpdkim pdkim/pdkim.a: config.h
 
 # The PDKIM library
 
 buildpdkim pdkim/pdkim.a: config.h
-        @cd pdkim; $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
+        @cd pdkim && $(MAKE) SHELL=$(SHELL) AR="$(AR)" $(MFLAGS) CC="$(CC)" CFLAGS="$(CFLAGS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
           FE="$(FE)" RANLIB="$(RANLIB)" RM_COMMAND="$(RM_COMMAND)" HDRS="$(PHDRS)" \
-          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"; \
-        echo " "
+          INCLUDE="$(INCLUDE) $(IPV6_INCLUDE) $(TLS_INCLUDE)"
+        @echo " "
 
 # The "clean", "install", and "makefile" targets just pass themselves back to
 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed
 
 # The "clean", "install", and "makefile" targets just pass themselves back to
 # the main Exim makefile. These targets will be obeyed only if "make" is obeyed