Skip to content

Commit

Permalink
separate prune eval
Browse files Browse the repository at this point in the history
  • Loading branch information
ahwagner committed Mar 3, 2024
1 parent b606e0e commit 294bec8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
35 changes: 17 additions & 18 deletions schema/Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
vpath %tag build
vpath %.classes build
.SECONDARY:
.DELETE_ON_ERROR:

BUILD_DIR := build

vpath %tag $(BUILD_DIR)
vpath %.classes $(BUILD_DIR)

SOURCES := $(wildcard *-source.yaml)
TAGS := $(SOURCES:-source.yaml=.tag)
BUILD_DIR := build/
IMPORTS := $(wildcard imports/*-source.yaml)
CLASS_FILTER_FILES = $(wildcard ${BUILD_DIR}*.classes)
FILTER_CLASSES = $(shell cat ${CLASS_FILTER_FILES})
FILTER_JSONS = $(FILTER_CLASSES:%=json/%.json)
FILTER_DEFS = $(FILTER_CLASSES:%=def/%.rst)


.SECONDARY:
.DELETE_ON_ERROR:

all: build-ordered ${TAGS} prune
all: build-ordered ${TAGS} prune.tag

build-ordered: | $(BUILD_DIR)

build:
mkdir $(BUILD_DIR)

%.tag: %.json-tag %.defs-tag
touch $(BUILD_DIR)$@
%.tag: %.classes %.json-tag %.defs-tag
touch $(BUILD_DIR)/$@

%.classes: %-source.yaml
source2classes.py <$< >$(BUILD_DIR)$@
source2classes.py $< >${BUILD_DIR}/$@

%.json-tag: %-source.yaml ${IMPORTS}
source2splitjs.py $<
touch $(BUILD_DIR)$@
touch $(BUILD_DIR)/$@

%.defs-tag: %-source.yaml ${IMPORTS}
y2t.py $<
touch $(BUILD_DIR)$@
touch $(BUILD_DIR)/$@

prune: $(filter-out ${FILTER_JSONS} ${FILTER_DEFS},$(wildcard def/* json/*))
rm $^
prune.tag: ${TAGS}
$(MAKE) -f prune.mk
touch $(BUILD_DIR)/$@

clean:
rm $(BUILD_DIR)*
rm $(BUILD_DIR)/*
11 changes: 11 additions & 0 deletions schema/prune.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BUILD_DIR := build
SOURCES := $(wildcard *-source.yaml)
CLASS_FILTER_FILES = $(SOURCES:%-source.yaml=${BUILD_DIR}/%.classes)
FILTER_CLASSES := $(shell cat ${CLASS_FILTER_FILES})
FILTER_JSONS = $(FILTER_CLASSES:%=json/%.json)
FILTER_DEFS = $(FILTER_CLASSES:%=def/%.rst)

.DEFAULT: prune

prune: $(filter-out ${FILTER_JSONS} ${FILTER_DEFS},$(wildcard def/* json/*))
$(if $^,rm $^)

0 comments on commit 294bec8

Please sign in to comment.