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