Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds makefile refinements and nyaml as dependency #1336

Merged
merged 5 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,17 @@
PYTHON = python3
SPHINX = sphinx-build
BUILD_DIR = "build"
BASE_CLASS_DIR := base_classes
CONTRIB_DIR := contributed_definitions
APPDEF_DIR := applications
NYAML_SUBDIR := nyaml
domna marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: help install style autoformat test clean prepare html pdf impatient-guide all local
YBC_NXDL = $(patsubst %.yaml,%.nxdl.xml,$(subst /nyaml/,/, $(wildcard $(BASE_CLASS_DIR)/nyaml/*.yaml)))
YCONTRIB_NXDL = $(patsubst %.yaml,%.nxdl.xml,$(subst /nyaml/,/, $(wildcard $(CONTRIB_DIR)/nyaml/*.yaml)))
YAPPDEF_NXDL = $(patsubst %.yaml,%.nxdl.xml,$(subst /nyaml/,/, $(wildcard $(APPDEF_DIR)/nyaml/*.yaml)))
domna marked this conversation as resolved.
Show resolved Hide resolved


.PHONY: help install style autoformat test clean prepare html pdf impatient-guide all local nxdl nyaml

help ::
@echo ""
Expand Down Expand Up @@ -50,6 +59,11 @@ test ::
clean ::
$(RM) -rf $(BUILD_DIR)

clean-nyaml ::
domna marked this conversation as resolved.
Show resolved Hide resolved
$(RM) -rf $(BASE_CLASS_DIR)/$(NYAML_SUBDIR)
$(RM) -rf $(APPDEF_DIR)/$(NYAML_SUBDIR)
$(RM) -rf $(CONTRIB_DIR)/$(NYAML_SUBDIR)

prepare ::
$(PYTHON) -m dev_tools manual --prepare --build-root $(BUILD_DIR)
$(PYTHON) -m dev_tools impatient --prepare --build-root $(BUILD_DIR)
Expand Down Expand Up @@ -83,6 +97,20 @@ all ::
@echo "HTML built: `ls -lAFgh $(BUILD_DIR)/manual/build/html/index.html`"
@echo "PDF built: `ls -lAFgh $(BUILD_DIR)/manual/build/latex/nexus.pdf`"

$(BASE_CLASS_DIR)/%.nxdl.xml : $(BASE_CLASS_DIR)/$(NYAML_SUBDIR)/%.yaml
domna marked this conversation as resolved.
Show resolved Hide resolved
nyaml2nxdl $< --output-file $@

$(CONTRIB_DIR)/%.nxdl.xml : $(CONTRIB_DIR)/$(NYAML_SUBDIR)/%.yaml
nyaml2nxdl $< --output-file $@

$(APPDEF_DIR)/%.nxdl.xml : $(APPDEF_DIR)/$(NYAML_SUBDIR)/%.yaml
nyaml2nxdl $< --output-file $@

nxdl: $(YBC_NXDL) $(YCONTRIB_NXDL) $(YAPPDEF_NXDL)
domna marked this conversation as resolved.
Show resolved Hide resolved

nyaml:
domna marked this conversation as resolved.
Show resolved Hide resolved
$(MAKE) -f nyaml.mk


# NeXus - Neutron and X-ray Common Data Format
#
Expand Down
22 changes: 22 additions & 0 deletions nyaml.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BASE_CLASS_DIR := base_classes
CONTRIB_DIR := contributed_definitions
APPDEF_DIR := applications
NYAML_SUBDIR := nyaml
NXDL_BC = $(addprefix $(BASE_CLASS_DIR)/nyaml/,$(notdir $(patsubst %.nxdl.xml,%.yaml,$(wildcard $(BASE_CLASS_DIR)/*.nxdl.xml))))
NXDL_APPDEF = $(addprefix $(APPDEF_DIR)/nyaml/,$(notdir $(patsubst %.nxdl.xml,%.yaml,$(wildcard $(APPDEF_DIR)/*.nxdl.xml))))
NXDL_CONTRIB = $(addprefix $(CONTRIB_DIR)/nyaml/,$(notdir $(patsubst %.nxdl.xml,%.yaml,$(wildcard $(CONTRIB_DIR)/*.nxdl.xml))))

.PHONY: all nyaml

$(BASE_CLASS_DIR)/$(NYAML_SUBDIR)/%.yaml : $(BASE_CLASS_DIR)/%.nxdl.xml
nyaml2nxdl $< --output-file $@

$(CONTRIB_DIR)/$(NYAML_SUBDIR)/%.yaml : $(CONTRIB_DIR)/%.nxdl.xml
nyaml2nxdl $< --output-file $@

$(APPDEF_DIR)/$(NYAML_SUBDIR)/%.yaml : $(APPDEF_DIR)/%.nxdl.xml
nyaml2nxdl $< --output-file $@

nyaml: $(NXDL_BC) $(NXDL_APPDEF) $(NXDL_CONTRIB)

all: nyaml
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Prepare for Documentation
lxml
pyyaml
nyaml

# Documentation building
sphinx>=5
Expand Down