diff --git a/Makefile b/Makefile index 7afd943..de5eb00 100644 --- a/Makefile +++ b/Makefile @@ -6,31 +6,31 @@ PDF_OUTPUT_DIR = $(OUTPUT_DIR)/pdf SVG_OUTPUT_DIR = $(OUTPUT_DIR)/svg BUILD_DIR = $(ROOT_DIR)/build -# List of .tex files in the TEX_DIR that do not start with an underscore -TEX_FILES := $(wildcard $(TEX_DIR)/*.tex) -TEX_FILES := $(filter-out $(TEX_DIR)/_%.tex, $(TEX_FILES)) +# Find all .tex files in TEX_DIR and its subdirectories, excluding those starting with an underscore +TEX_FILES := $(shell find $(TEX_DIR) -type f -name '*.tex' ! -name '_*.tex') PDF_FILES := $(patsubst $(TEX_DIR)/%.tex, $(PDF_OUTPUT_DIR)/%.pdf, $(TEX_FILES)) SVG_FILES := $(patsubst $(TEX_DIR)/%.tex, $(SVG_OUTPUT_DIR)/%.svg, $(TEX_FILES)) +BUILD_FILES := $(patsubst $(TEX_DIR)/%.tex, $(BUILD_DIR)/%.aux, $(TEX_FILES)) # Example of intermediate files -# Latex compilation command with BUILD_DIR for intermediate files -LATEXMK = latexmk -cd -pdf -shell-escape -outdir=$(BUILD_DIR) -auxdir=$(BUILD_DIR) +# Latex compilation command +LATEXMK = latexmk -cd -pdf -shell-escape # Rule to compile all .tex files to .pdf and .svg all: $(PDF_FILES) $(SVG_FILES) -# Individual PDF file compilation, moving final PDF to PDF_OUTPUT_DIR +# Rule for compiling PDFs, preserving subdirectory structure $(PDF_OUTPUT_DIR)/%.pdf: $(TEX_DIR)/%.tex - @mkdir -p $(PDF_OUTPUT_DIR) $(BUILD_DIR) - $(LATEXMK) $< - @mv $(BUILD_DIR)/$*.pdf $(PDF_OUTPUT_DIR)/ + @mkdir -p $(dir $@) $(BUILD_DIR)/$(dir $*) + $(LATEXMK) -outdir=$(BUILD_DIR)/$(dir $*) $< + @mv $(BUILD_DIR)/$*.pdf $@ -# Convert each PDF to SVG using pdf2svg, placing SVGs in SVG_OUTPUT_DIR +# Rule for converting PDFs to SVGs, preserving subdirectory structure $(SVG_OUTPUT_DIR)/%.svg: $(PDF_OUTPUT_DIR)/%.pdf - @mkdir -p $(SVG_OUTPUT_DIR) + @mkdir -p $(dir $@) pdf2svg $< $@ # Clean command to remove generated files in OUTPUT_DIR and BUILD_DIR clean: - rm -rf $(OUTPUT_DIR)/* $(BUILD_DIR)/* + rm -rf $(OUTPUT_DIR) $(BUILD_DIR) .PHONY: all clean diff --git a/tex/_common.tex b/tex/geometry/gen3/_common.tex similarity index 100% rename from tex/_common.tex rename to tex/geometry/gen3/_common.tex diff --git a/tex/acts_fig_impl_layer_geometry.tex b/tex/geometry/gen3/acts_fig_impl_layer_geometry.tex similarity index 100% rename from tex/acts_fig_impl_layer_geometry.tex rename to tex/geometry/gen3/acts_fig_impl_layer_geometry.tex diff --git a/tex/barrel_endcap.tex b/tex/geometry/gen3/barrel_endcap.tex similarity index 100% rename from tex/barrel_endcap.tex rename to tex/geometry/gen3/barrel_endcap.tex diff --git a/tex/cvs_rdir.tex b/tex/geometry/gen3/cvs_rdir.tex similarity index 100% rename from tex/cvs_rdir.tex rename to tex/geometry/gen3/cvs_rdir.tex diff --git a/tex/cvs_zdir.tex b/tex/geometry/gen3/cvs_zdir.tex similarity index 100% rename from tex/cvs_zdir.tex rename to tex/geometry/gen3/cvs_zdir.tex diff --git a/tex/fuse.tex b/tex/geometry/gen3/fuse.tex similarity index 100% rename from tex/fuse.tex rename to tex/geometry/gen3/fuse.tex diff --git a/tex/generations.tex b/tex/geometry/gen3/generations.tex similarity index 100% rename from tex/generations.tex rename to tex/geometry/gen3/generations.tex diff --git a/tex/geo_binning.tex b/tex/geometry/gen3/geo_binning.tex similarity index 100% rename from tex/geo_binning.tex rename to tex/geometry/gen3/geo_binning.tex diff --git a/tex/layer_ec.tex b/tex/geometry/gen3/layer_ec.tex similarity index 100% rename from tex/layer_ec.tex rename to tex/geometry/gen3/layer_ec.tex diff --git a/tex/layers.tex b/tex/geometry/gen3/layers.tex similarity index 100% rename from tex/layers.tex rename to tex/geometry/gen3/layers.tex diff --git a/tex/material.tex b/tex/geometry/gen3/material.tex similarity index 100% rename from tex/material.tex rename to tex/geometry/gen3/material.tex diff --git a/tex/merge.tex b/tex/geometry/gen3/merge.tex similarity index 100% rename from tex/merge.tex rename to tex/geometry/gen3/merge.tex diff --git a/tex/navigation.tex b/tex/geometry/gen3/navigation.tex similarity index 100% rename from tex/navigation.tex rename to tex/geometry/gen3/navigation.tex diff --git a/tex/policies.tex b/tex/geometry/gen3/policies.tex similarity index 100% rename from tex/policies.tex rename to tex/geometry/gen3/policies.tex diff --git a/tex/portals.tex b/tex/geometry/gen3/portals.tex similarity index 100% rename from tex/portals.tex rename to tex/geometry/gen3/portals.tex diff --git a/tex/simpl_geom.tex b/tex/geometry/gen3/simpl_geom.tex similarity index 100% rename from tex/simpl_geom.tex rename to tex/geometry/gen3/simpl_geom.tex