Browse code

makefile: per modules arch. indep. files install support

Support for easily adding arch. independent files that should be
installed along a module.
The following new module makefile variable is supported:

MOD_INSTALL_SHARE - list of files to install into the
arch-independent shared directory (by default
/usr/local/share/$(MAIN_NAME)).

Andrei Pelinescu-Onciul authored on 01/10/2009 14:48:30
Showing 1 changed files
... ...
@@ -48,6 +48,11 @@
48 48
 #
49 49
 # MOD_INSTALL_CFGS - list of extra config files that should be installed in
50 50
 #                    the main config directory, along the module (OPTIONAL).
51
+#
52
+# MOD_INSTALL_SHARE - list of files to install into the arch-independent
53
+#                     shared directory (by default
54
+#                     /usr/local/share/$(MAIN_NAME))
55
+#
51 56
 
52 57
 MOD_NAME=$(NAME:.so=)
53 58
 
... ...
@@ -119,7 +124,7 @@ LIBS:=$(filter-out -ldl -lresolv, $(LIBS))
119 124
 .PHONY: install-scripts
120 125
 .PHONY: install-cfgs
121 126
 install: $(NAME) $(mods_dst) install-libs install-utils install-scripts \
122
-		install-cfg
127
+		install-cfg install-share
123 128
 	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
124 129
 	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
125 130
 
... ...
@@ -191,6 +196,29 @@ install-cfg:
191 196
 
192 197
 endif # $(MOD_INSTALL_CFGS)
193 198
 
199
+ifneq (,$(MOD_INSTALL_SHARE))
200
+install-share: $(share_prefix)/$(share_dir)
201
+	@for r in $(MOD_INSTALL_SHARE) ; do \
202
+		if [ -n "$$r" ]; then \
203
+			if [ -f "$$r" ]; then \
204
+				$(call try_err, $(INSTALL_TOUCH) \
205
+					$(share_prefix)/$(share_dir)/`basename "$$r"` ); \
206
+				$(call try_err,\
207
+					$(INSTALL_SHARE)  "$$r"  $(share_prefix)/$(share_dir) ); \
208
+			else \
209
+				echo "ERROR: $$r not found" ; \
210
+				if [ ${err_fail} = 1 ] ; then \
211
+					exit 1; \
212
+				fi ; \
213
+			fi ; \
214
+		fi ; \
215
+	done; true
216
+
217
+else
218
+install-share:
219
+
220
+endif # $(MOD_INSTALL_SHARE)
221
+
194 222
 
195 223
 $(bin_prefix)/$(bin_dir):
196 224
 	mkdir -p $@
... ...
@@ -198,6 +226,9 @@ $(bin_prefix)/$(bin_dir):
198 226
 $(cfg_prefix)/$(cfg_dir):
199 227
 	mkdir -p $@
200 228
 
229
+$(share_prefix)/$(share_dir):
230
+	mkdir -p $@
231
+
201 232
 # README build rules
202 233
 ifneq (,$(wildcard doc/Makefile))
203 234
 #doc/Makefile present => we can generate README