From 171094a10ce9efc45f85a1de6827e869d9b0cdc5 Mon Sep 17 00:00:00 2001 From: Ken Lauer Date: Mon, 17 Oct 2022 16:15:00 -0700 Subject: [PATCH 1/2] MNT: add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..214d6e46 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +realpath From c2f360a812d172024cb68559f5a643b97c828686 Mon Sep 17 00:00:00 2001 From: Ken Lauer Date: Mon, 17 Oct 2022 16:19:33 -0700 Subject: [PATCH 2/2] Merging Makefile.template + RULES_EXPAND --- Makefile.template | 2 +- RULES_EXPAND | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Makefile.template b/Makefile.template index 212208b9..690d48ce 100644 --- a/Makefile.template +++ b/Makefile.template @@ -51,7 +51,7 @@ expandAll: $(TEMPS) $(EXPAND) config $(EXPAND) $(IOC_APPL_TOP)/iocBoot/templates/ioc.sub-arch $(IOC).sub-arch $(EXPAND_FLAGS) $(EXPAND) $(IOC_APPL_TOP)/iocBoot/templates/ioc.sub-req $(IOC).sub-req $(EXPAND_FLAGS) $(EXPAND) $(IOC_APPL_TOP)/iocBoot/templates/st.cmd st.cmd $(EXPAND_FLAGS) - chmod guo+x st.cmd + -chmod guo+x st.cmd clean realclean:: expandclean diff --git a/RULES_EXPAND b/RULES_EXPAND index 12bbea27..039be763 100644 --- a/RULES_EXPAND +++ b/RULES_EXPAND @@ -1,8 +1,8 @@ # # RULES_EXPAND # Creates build rules needed to expand templated IOC config files -# -EXPAND = /reg/g/pcds/controls/macro/expand +RULES_EXPAND := $(lastword $(MAKEFILE_LIST)) +EXPAND := $(dir $(RULES_EXPAND))/expand ifeq ($(BUILD_TOP),) BUILD_TOP = build @@ -28,7 +28,7 @@ DIR_LIST += $(BUILD_TOP)/iocBoot default: install all: install -.PHONY: install expand +.PHONY: build install expand install: expand @$(MAKE) -C $(BUILD_TOP) $@ @@ -55,6 +55,7 @@ IOC_DEP_PATTERN += $(addprefix $(BUILD_TOP)/iocBoot/__IOC__/, $$(IOC_DEP_SH)) $(1)_DEP_LIST = $$(subst __IOC__,$(1),$$(IOC_DEP_PATTERN)) DIR_LIST += $(BUILD_TOP)/iocBoot/$(1) +.PHONY: $(BUILD_TOP)/iocBoot/$(1) expand: $(1).cfg $(BUILD_TOP)/iocBoot/$(1) $$($(1)_DEP_LIST) @@ -68,43 +69,43 @@ $(1): $$(DIR_LIST) $$($(1)_DEP_LIST) $(BUILD_TOP)/iocBoot/$(1)/Makefile: $(IOC_APPL_TOP)/iocBoot/templates/Makefile @echo Expanding $$@ @$(EXPAND) -c $(1).cfg $$(<) $$@ IOCNAME=$(1) TOP=$(BUILD_TOP_ABS) IOCTOP=$(IOC_APPL_TOP) - @chmod ug+w $$@ + @-chmod ug+w $$@ # Expand $(BUILD_TOP)/iocBoot/$(1)/st.cmd $(BUILD_TOP)/iocBoot/$(1)/st.cmd: $(IOC_APPL_TOP)/iocBoot/templates/st.cmd @echo Expanding $$@ @$(EXPAND) -c $(1).cfg $$(<) $$@ IOCNAME=$(1) TOP=$(BUILD_TOP_ABS) IOCTOP=$(IOC_APPL_TOP) - @chmod ug+w,a+x $$@ + @-chmod ug+w,a+x $$@ # Expand $(BUILD_TOP)/iocBoot/$(1)/edm-$(1).cmd $(BUILD_TOP)/iocBoot/$(1)/edm-$(1).cmd: $(1).cfg @echo Expanding $$@ @if [ -f $(IOC_APPL_TOP)/iocBoot/templates/edm-ioc.cmd ]; then $(EXPAND) -c $(1).cfg $(IOC_APPL_TOP)/iocBoot/templates/edm-ioc.cmd $$@ IOCNAME=$(1) TOP=$(BUILD_TOP_ABS) IOCTOP=$(IOC_APPL_TOP); else echo "#!/bin/sh" > $$@; echo "echo No $(IOC_APPL_TOP)/iocBoot/templates/edm-ioc.cmd found!" >> $$@; fi - @chmod ug+w,a+x $$@ + @-chmod ug+w,a+x $$@ # Expand $(BUILD_TOP)/iocBoot/$(1)/pydm-$(1).cmd $(BUILD_TOP)/iocBoot/$(1)/pydm-$(1).cmd: $(1).cfg @echo Expanding $$@ @if [ -f $(IOC_APPL_TOP)/iocBoot/templates/pydm-ioc.cmd ]; then $(EXPAND) -c $(1).cfg $(IOC_APPL_TOP)/iocBoot/templates/pydm-ioc.cmd $$@ IOCNAME=$(1) TOP=$(BUILD_TOP_ABS) IOCTOP=$(IOC_APPL_TOP); else echo "#!/bin/sh" > $$@; echo "echo No $(IOC_APPL_TOP)/iocBoot/templates/pydm-ioc.cmd found!" >> $$@; fi - @chmod ug+w,a+x $$@ + @-chmod ug+w,a+x $$@ # Create $(BUILD_TOP)/iocBoot/$(1)/IOC_APPL_TOP $(BUILD_TOP)/iocBoot/$(1)/IOC_APPL_TOP: @echo Setting IOC_APPL_TOP to $(IOC_APPL_TOP) for $(1) @echo "IOC_APPL_TOP=$(IOC_APPL_TOP)" > $$@ - @chmod ug+w $$@ + @-chmod ug+w $$@ # Expand ioc.sub-arch and ioc.sub-req $(BUILD_TOP)/iocBoot/$(1)/$(1).%: $(IOC_APPL_TOP)/iocBoot/templates/ioc.% @echo Expanding $$@ @$(EXPAND) -c $(1).cfg $$(<) $$(@) IOCNAME=$(1) TOP=$(BUILD_TOP_ABS) IOCTOP=$(IOC_APPL_TOP) - @chmod ug+w $$@ + @-chmod ug+w $$@ # Expand any *.sh files $(BUILD_TOP)/iocBoot/$(1)/%.sh: $(IOC_APPL_TOP)/iocBoot/templates/%.sh @echo Expanding $$@ @$(EXPAND) -c $(1).cfg $$(<) $$(@) IOCNAME=$(1) TOP=$(BUILD_TOP_ABS) IOCTOP=$(IOC_APPL_TOP) - @chmod ug+w $$@ + @-chmod ug+w $$@ endef # End of EXPAND_template @@ -127,19 +128,19 @@ $(foreach IOC, $(IOC_LIST), \ $(BUILD_TOP)/Makefile: $(IOC_APPL_TOP)/Makefile @echo Installing $@ @cp -u $< $@ - @chmod ug+w $@ + @-chmod ug+w $@ # Ditto for the iocBoot Makefile $(BUILD_TOP)/iocBoot/Makefile: $(IOC_APPL_TOP)/iocBoot/Makefile @echo Installing $@ @cp -u $< $@ - @chmod ug+w $@ + @-chmod ug+w $@ # Create $(BUILD_TOP)/IOC_APPL_TOP $(BUILD_TOP)/IOC_APPL_TOP: @echo Creating IOC_APPL_TOP @echo "IOC_APPL_TOP=$(IOC_APPL_TOP)" > $@ - @chmod ug+w $@ + @-chmod ug+w $@ # Build rule for directories $(DIR_LIST): @@ -148,6 +149,7 @@ $(DIR_LIST): # These are our source files # No need to look for implicit rules for these +$(makefile): ; %/iocBoot/templates/ioc.sub-arch: ; %/iocBoot/templates/ioc.sub-req: ; %/iocBoot/templates/Makefile: ;