Browse code

makefiles: added Makefile.utils

- added Makefile.utils
- updated utils/{gen_ha1,sercmd} to use it

Andrei Pelinescu-Onciul authored on 23/04/2009 13:44:41
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,81 @@
1
+#
2
+# $Id$
3
+#
4
+# utils Makefile
5
+#(to be included from each util/ subdirectory)
6
+#
7
+# History:
8
+# --------
9
+#  2009-04-23  initial version derived from Makefile.modules (andrei)
10
+
11
+
12
+# default path to the core makefiles
13
+COREPATH ?=../..
14
+
15
+ALLDEP=Makefile $(COREPATH)/Makefile.sources $(COREPATH)/Makefile.rules \
16
+ $(COREPATH)/Makefile.utils $(COREPATH)/Makefile.dirs $(COREPATH)/config.mak
17
+
18
+#override modules value, an util cannot have submodules
19
+override modules=
20
+override static_modules=
21
+override static_modules_path=
22
+
23
+ifneq ($(makefile_defs_included),1)
24
+$(error "the local makefile does not include Makefile.defs!")
25
+endif
26
+
27
+ifeq ($(MAKELEVEL), 0)
28
+# make called directly in the module dir!
29
+
30
+else
31
+# called by the main Makefile
32
+
33
+ALLDEP+=$(COREPATH)/Makefile
34
+
35
+endif
36
+
37
+include $(COREPATH)/Makefile.sources
38
+
39
+
40
+# if config was not loaded (makefile_defs!=1) ignore
41
+# the rest of makefile and try only to remake the config
42
+ifeq ($(makefile_defs),1)
43
+
44
+
45
+include $(COREPATH)/Makefile.dirs
46
+include $(COREPATH)/Makefile.targets
47
+include $(COREPATH)/Makefile.rules
48
+
49
+modules:
50
+
51
+# README build rules
52
+ifneq (,$(wildcard doc/Makefile))
53
+#doc/Makefile present => we can generate README
54
+
55
+README: doc/*.xml
56
+	$(MAKE) -C doc $(MOD_NAME).txt
57
+	mv doc/$(MOD_NAME).txt $@
58
+
59
+else
60
+# do nothing
61
+
62
+README:
63
+endif
64
+
65
+#man page build rules
66
+ifneq (,$(wildcard $(MOD_NAME).xml))
67
+
68
+$(MOD_NAME).7: $(MOD_NAME).xml
69
+	docbook2x-man -s ../../doc/stylesheets/serdoc2man.xsl $<
70
+
71
+man: $(MOD_NAME).7
72
+
73
+else
74
+
75
+man:
76
+
77
+endif
78
+
79
+endif # ifeq($(makefile_defs),1)
80
+
81
+include $(COREPATH)/Makefile.cfg
... ...
@@ -10,8 +10,4 @@ NAME=gen_ha1
10 10
 LIBS=../../md5.o
11 11
 
12 12
 
13
-include ../../Makefile.sources
14
-include ../../Makefile.targets
15
-include ../../Makefile.rules
16
-
17
-modules:
13
+include ../../Makefile.utils
... ...
@@ -1,7 +1,7 @@
1 1
 # $Id$
2
-
3
-include ../../Makefile.defs
4
-include ../../Makefile.targets
2
+COREPATH=../..
3
+include $(COREPATH)/Makefile.defs
4
+include $(COREPATH)/Makefile.targets
5 5
 
6 6
 auto_gen=
7 7
 NAME=sercmd
... ...
@@ -43,8 +43,7 @@ ifeq ($(use_readline),1)
43 43
 endif
44 44
 
45 45
 
46
-include ../../Makefile.sources
47
-include ../../Makefile.rules
46
+include $(COREPATH)/Makefile.utils
48 47
 
49 48
 ifeq (,$(quiet))
50 49
 ifeq ($(use_readline),1)