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 119
 .PHONY: install-scripts
120 120
 .PHONY: install-cfgs
121 121
 install: $(NAME) $(mods_dst) install-libs install-utils install-scripts \
122
-		install-cfg
122
+		install-cfg install-share
123 123
 	$(INSTALL_TOUCH) $(mods_dst)/$(NAME)
124 124
 	$(INSTALL_MODULES)  $(NAME)  $(mods_dst)
125 125
 
... ...
@@ -191,6 +196,29 @@ install-cfg:
191 191
 
192 192
 endif # $(MOD_INSTALL_CFGS)
193 193
 
194
+ifneq (,$(MOD_INSTALL_SHARE))
195
+install-share: $(share_prefix)/$(share_dir)
196
+	@for r in $(MOD_INSTALL_SHARE) ; do \
197
+		if [ -n "$$r" ]; then \
198
+			if [ -f "$$r" ]; then \
199
+				$(call try_err, $(INSTALL_TOUCH) \
200
+					$(share_prefix)/$(share_dir)/`basename "$$r"` ); \
201
+				$(call try_err,\
202
+					$(INSTALL_SHARE)  "$$r"  $(share_prefix)/$(share_dir) ); \
203
+			else \
204
+				echo "ERROR: $$r not found" ; \
205
+				if [ ${err_fail} = 1 ] ; then \
206
+					exit 1; \
207
+				fi ; \
208
+			fi ; \
209
+		fi ; \
210
+	done; true
211
+
212
+else
213
+install-share:
214
+
215
+endif # $(MOD_INSTALL_SHARE)
216
+
194 217
 
195 218
 $(bin_prefix)/$(bin_dir):
196 219
 	mkdir -p $@
... ...
@@ -198,6 +226,9 @@ $(bin_prefix)/$(bin_dir):
198 198
 $(cfg_prefix)/$(cfg_dir):
199 199
 	mkdir -p $@
200 200
 
201
+$(share_prefix)/$(share_dir):
202
+	mkdir -p $@
203
+
201 204
 # README build rules
202 205
 ifneq (,$(wildcard doc/Makefile))
203 206
 #doc/Makefile present => we can generate README