Skip to content

Commit

Permalink
use addsuffix function
Browse files Browse the repository at this point in the history
  • Loading branch information
fadado committed Apr 6, 2017
1 parent 8a44751 commit 74af276
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ endif
# NodesJSON
# Targets:
# $(Destination)
# all paths at $(Destination) and $(Metadata)
# all paths from $(Destination) and $(Metadata)

endif # not clobbering

Expand Down Expand Up @@ -178,7 +178,7 @@ $(Metadata)/snippets.json: $(Content)/snippets.yaml \
@jqt -T < $< | yaml2json > $@

# HTML pages
define Target
define Target =
$(Destination)/$(1).html: $(Content)/$(1).md $(Layouts)/$(2).html \
| $(Destination)
$$(info ==> $$@)
Expand Down
4 changes: 3 additions & 1 deletion docs/make.d/config.make
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ empty :=
space := $(empty) $(empty)

# Hack for list manipulation
rest = $(wordlist 2,2147483648,$1)
define rest =
$(wordlist 2,2147483648,$1)
endef

# vim:ai:sw=8:ts=8:noet:fileencoding=utf8:syntax=make
14 changes: 8 additions & 6 deletions docs/make.d/introspect.make
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
########################################################################
# Introspection of filesystem and files's front-matter
# Introspection of filesystem
########################################################################

# Imported variables:
Expand Down Expand Up @@ -39,13 +39,14 @@ $(Destination):
$(info ==> $@)
@mkdir -p $@ >/dev/null 2>&1 || true

$(i_paths_destination): $(Destination)/% : $(Content)/%
# TODO: static rules??? Targets are directories...???
$(i_paths_destination): #? $(Destination)/% : $(Content)/%
@mkdir -p $@ >/dev/null 2>&1 || true

$(i_paths_meta_pages): $(Metadata)/pages/% : $(Content)/%
$(i_paths_meta_pages): #? $(Metadata)/pages/% : $(Content)/%
@mkdir -p $@ >/dev/null 2>&1 || true

$(i_paths_meta_nodes): $(Metadata)/nodes/% : $(Content)/%
$(i_paths_meta_nodes): #? $(Metadata)/nodes/% : $(Content)/%
@mkdir -p $@ >/dev/null 2>&1 || true

#
Expand All @@ -62,13 +63,14 @@ Pages := $(patsubst %.md,%.html,$(patsubst $(Content)%,$(Destination)%,$(i_docum
PagesJSON := $(patsubst %.md,%.json,$(patsubst $(Content)%,$(Metadata)/pages%,$(i_documents)))

# Nodes to generate at $(Destination)
Nodes := $(patsubst %/,%/index.html,$(i_paths_destination))
Nodes := $(addsuffix index.html,$(i_paths_destination))

# JSON for each node to generate at $(Metadata)/nodes
NodesJSON := $(call rest,$(patsubst %/,%.json,$(i_paths_meta_nodes)))

#########################################################################
# Test
.PHONY: intro
intro:
@echo 'Metadata: $(Metadata)'
@echo 'Content: $(Content)'
Expand All @@ -77,9 +79,9 @@ intro:
@echo 'i_documents: $(i_documents)'
@echo 'i_paths: $(i_paths)'
@echo
@echo 'i_paths_destination: $(i_paths_destination)'
@echo 'i_paths_meta_nodes: $(i_paths_meta_nodes)'
@echo 'i_paths_meta_pages: $(i_paths_meta_pages)'
@echo 'i_paths_destination: $(i_paths_destination)'
@echo
@echo 'HomePage: $(HomePage)'
@echo 'Pages: $(Pages)'
Expand Down
1 change: 1 addition & 0 deletions docs/make.d/metadata.make
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ifdef __globals__
# Metadata files built with globals defined
#

#########################################################################
# Build all metadata files (utility not called automatically)
.PHONY: metadata
metadata: \
Expand Down

0 comments on commit 74af276

Please sign in to comment.