Browse code

Makefile: test if cfg, -basic and -oob exist

- cfg install check the existence of the files before atempting to copy
- name of cfg to install depends on flavour

Daniel-Constantin Mierla authored on 28/01/2010 13:07:45
Showing 1 changed files
... ...
@@ -888,26 +888,42 @@ $(man_prefix)/$(man_dir)/man5:
888 888
 
889 889
 # note: sed with POSIX.1 regex doesn't support |, + or ? (darwin, solaris ...) 
890 890
 install-cfg: $(cfg_prefix)/$(cfg_dir)
891
-		@sed $(foreach m,$(modules_dirs),\
892
-				-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
893
-			< etc/$(CFG_NAME)-basic.cfg > \
894
-			$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample
895
-		@chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample
896
-		@if [ -z "${skip_cfg_install}" -a \
897
-				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \
898
-			mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample \
899
-				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \
891
+		@if [ -f etc/$(CFG_NAME).cfg ]; then \
892
+			sed $(foreach m,$(modules_dirs),\
893
+					-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
894
+				< etc/$(CFG_NAME).cfg > \
895
+				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \
896
+			chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample; \
897
+			if [ -z "${skip_cfg_install}" -a \
898
+					! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg ]; then \
899
+				mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg.sample \
900
+					$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME).cfg; \
901
+			fi; \
902
+		fi
903
+		@if [ -f etc/$(CFG_NAME)-basic.cfg ]; then \
904
+			sed $(foreach m,$(modules_dirs),\
905
+					-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
906
+				< etc/$(CFG_NAME)-basic.cfg > \
907
+				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \
908
+			chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample; \
909
+			if [ -z "${skip_cfg_install}" -a \
910
+					! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg ]; then \
911
+				mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg.sample \
912
+					$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-basic.cfg; \
913
+			fi; \
900 914
 		fi
901
-		@sed $(foreach m,$(modules_dirs),\
902
-			-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
903
-			< etc/$(CFG_NAME)-oob.cfg \
904
-			> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample
905
-		@chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample
906
-		@if [ -z "${skip_cfg_install}" -a \
907
-				! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \
908
-		then \
909
-			mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \
910
-				$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \
915
+		@if [ -f etc/$(CFG_NAME)-oob.cfg ]; then \
916
+			sed $(foreach m,$(modules_dirs),\
917
+				-e "s#/usr/[^:]*lib/$(CFG_NAME)/$(m)\([:/\"]\)#$($(m)_target)\1#g") \
918
+				< etc/$(CFG_NAME)-oob.cfg \
919
+				> $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \
920
+			chmod 644 $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample; \
921
+			if [ -z "${skip_cfg_install}" -a \
922
+					! -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg ]; \
923
+			then \
924
+				mv -f $(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg.sample \
925
+					$(cfg_prefix)/$(cfg_dir)$(MAIN_NAME)-advanced.cfg; \
926
+			fi; \
911 927
 		fi
912 928
 		# other configs
913 929
 		@for r in $(C_INSTALL_CFGS) ; do \