restructured premake
svn path=/trunk/; revision=35116
This commit is contained in:
parent
6879373b4a
commit
6a13e3b186
111
Makefile
111
Makefile
@ -1,6 +1,6 @@
|
||||
.PHONY: all
|
||||
|
||||
all: subdirs localmenus date_today SOURCEUPDATES
|
||||
.PHONY: all .FORCE
|
||||
.FORCE:
|
||||
all:
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Dive into subdirectories
|
||||
@ -8,61 +8,47 @@ all: subdirs localmenus date_today SOURCEUPDATES
|
||||
|
||||
SUBDIRS := $(shell find */* -name "Makefile" | xargs dirname)
|
||||
|
||||
.PHONY: subdirs $(SUBDIRS)
|
||||
$(SUBDIRS): .FORCE
|
||||
$(MAKE) -j -k -C $@ || true
|
||||
|
||||
subdirs: $(SUBDIRS)
|
||||
|
||||
# run jobs for tools/ only after events/ and news/ have been completed
|
||||
tools: | events news
|
||||
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -k -C $@ || true
|
||||
all: $(SUBDIRS)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Handle local menus
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
HELPERFILE := menuhelper
|
||||
SELECT := '<localmenu.*</localmenu>'
|
||||
STYLESHEET := ./tools/buildmenu.xsl
|
||||
MENUSOURCES := $(shell find -name '*.xhtml' |xargs grep -l '<localmenu.*</localmenu>' )
|
||||
|
||||
FIND := ./\(.*/\)*\(.*\)\.\([a-z][a-z]\)\.xhtml:[ \t]*\(.*\)
|
||||
REPLACE := <menuitem language="\3"><dir>/\1</dir><link>\2.html</link>\4</menuitem>
|
||||
localmenuinfo.en.xml: ./tools/buildmenu.xsl $(MENUSOURCES)
|
||||
{ printf '<localmenuset>'; \
|
||||
grep -E '<localmenu.*</localmenu>' $^ \
|
||||
| sed -r 's;(.*/)?(.+)\.([a-z][a-z])\.xhtml:(.+);\
|
||||
<menuitem language="\3"><dir>/\1</dir><link>\2.html</link>\4</menuitem>;'; \
|
||||
printf '</localmenuset>'; \
|
||||
} | xsltproc -o $@ $< -
|
||||
|
||||
sources := $(shell grep -l -R --include='*.xhtml' $(SELECT) . )
|
||||
all: localmenuinfo.en.xml
|
||||
|
||||
.PHONY: localmenus
|
||||
# -----------------------------------------------------------------------------
|
||||
# Timestamp files for regular jobs and XML inclusion in various places
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
localmenus: localmenuinfo.en.xml
|
||||
|
||||
localmenuinfo.en.xml: $(sources) $(STYLESHEET)
|
||||
echo \<localmenuset\> > $(HELPERFILE)
|
||||
grep -R --include='*.xhtml' $(SELECT) .| sed -e 's,$(FIND),$(REPLACE),' >> $(HELPERFILE)
|
||||
echo \</localmenuset\> >> $(HELPERFILE)
|
||||
xsltproc -o $@ $(STYLESHEET) $(HELPERFILE)
|
||||
rm $(HELPERFILE)
|
||||
|
||||
YEAR := <?xml version="1.0" encoding="utf-8"?><dateset><date year="$(shell date +%Y)" /></dateset>
|
||||
YEAR := <?xml version="1.0" encoding="utf-8"?><dateset><date year="$(shell date +%Y)" /></dateset>
|
||||
MONTH := <?xml version="1.0" encoding="utf-8"?><dateset><date month="$(shell date +%Y-%m)" /></dateset>
|
||||
DAY := <?xml version="1.0" encoding="utf-8"?><dateset><date day="$(shell date +%Y-%m-%d)" /></dateset>
|
||||
DAY := <?xml version="1.0" encoding="utf-8"?><dateset><date day="$(shell date +%Y-%m-%d)" /></dateset>
|
||||
|
||||
.PHONY: date_today d_day.en.xml
|
||||
date_today: d_year.en.xml d_month.en.xml d_day.en.xml
|
||||
d_day.en.xml: $(if $(findstring $(DAY),$(shell cat d_day.en.xml)),,.FORCE)
|
||||
printf %s\\n '$(DAY)' >$@
|
||||
d_month.en.xml: $(if $(findstring $(MONTH),$(shell cat d_month.en.xml)),,.FORCE)
|
||||
printf %s\\n '$(MONTH)' >$@
|
||||
d_year.en.xml: $(if $(findstring $(YEAR),$(shell cat d_year.en.xml)),,.FORCE)
|
||||
printf %s\\n '$(YEAR)' >$@
|
||||
|
||||
d_day.en.xml:
|
||||
grep -q '$(DAY)' $@ || echo '$(DAY)' >$@
|
||||
d_month.en.xml: d_day.en.xml
|
||||
grep -q '$(MONTH)' $@ || echo '$(MONTH)' >$@
|
||||
d_year.en.xml: d_month.en.xml
|
||||
grep -q '$(YEAR)' $@ || echo '$(YEAR)' >$@
|
||||
all: d_year.en.xml d_month.en.xml d_day.en.xml
|
||||
|
||||
.PHONY: SOURCEUPDATES
|
||||
|
||||
# finish jobs in subdirs before updating .sources
|
||||
SOURCEUPDATES: | subdirs
|
||||
|
||||
SOURCEUPDATES: $(shell find ./ -name '*.sources')
|
||||
SOURCEREQS = $(shell ./build/source_globber.sh sourceglobs $@ |sed -r 's;$$;.??.xml;g')
|
||||
# -----------------------------------------------------------------------------
|
||||
# Update .sources files
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# use shell globbing to work around faulty globbing in gnu make
|
||||
SOURCEDIRS = $(shell sed -rn 's;^(.*/)[^/]*:(\[\]|global)$$;\1;gp' $@ \
|
||||
@ -70,6 +56,41 @@ SOURCEDIRS = $(shell sed -rn 's;^(.*/)[^/]*:(\[\]|global)$$;\1;gp' $@ \
|
||||
printf '%s\n' $$glob; \
|
||||
done \
|
||||
)
|
||||
SOURCEREQS = $(shell ./build/source_globber.sh sourceglobs $@ |sed -r 's;$$;.??.xml;g')
|
||||
|
||||
all: $(shell find ./ -name '*.sources')
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# generate tag maps
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
TAGMAP := $(shell find $(PWD) -name '*.xml' \
|
||||
| xargs ./build/source_globber.sh map_tags \
|
||||
)
|
||||
|
||||
TAGNAMES := $(shell printf %s '$(TAGMAP)' \
|
||||
| cut -d" " -f2- \
|
||||
| tr ' ' '\n' \
|
||||
| grep -vE '[\$%/:()]' \
|
||||
| sort -u \
|
||||
| xargs printf 'tools/tagmaps/%s.map ' \
|
||||
)
|
||||
|
||||
MAPREQS = $(shell printf %s '$(TAGMAP)' \
|
||||
| sed -r 's;[^ ]+\...\.xml;\n&;g' \
|
||||
| grep ' $*' \
|
||||
| cut -d' ' -f1 \
|
||||
)
|
||||
|
||||
all: $(TAGNAMES)
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Second Expansion rules
|
||||
# -----------------------------------------------------------------------------
|
||||
.SECONDEXPANSION:
|
||||
%.sources: $$(SOURCEDIRS) $$(SOURCEREQS)
|
||||
|
||||
%.sources: $$(SOURCEDIRS) $$(SOURCEREQS) | $(TAGNAMES)
|
||||
touch $@
|
||||
|
||||
tools/tagmaps/%.map: $$(MAPREQS) | $(SUBDIRS)
|
||||
printf '%s\n' $^ > $@
|
||||
|
@ -17,7 +17,7 @@ build_into(){
|
||||
|
||||
validate_caches
|
||||
|
||||
make -j $ncpu -C "$basedir" \
|
||||
make -C "$basedir" \
|
||||
| t_logstatus premake
|
||||
|
||||
dir_maker "$basedir" "$stagedir"
|
||||
|
@ -1,7 +1,15 @@
|
||||
.PHONY: generated_xml/wikievents.en.xml
|
||||
.PHONY: all .FORCE
|
||||
.FORCE:
|
||||
all:
|
||||
|
||||
generated_xml/wikievents.en.xml:
|
||||
# -----------------------------------------------------------------------------
|
||||
# Fetch event calendar from Wiki
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
generated_xml/wikievents.en.xml: .FORCE
|
||||
wget --user-agent="" -qO- "https://wiki.fsfe.org/Events/Published?action=refresh" \
|
||||
| xsltproc --html ../tools/wikicalendars.xsl - 2>&- \
|
||||
| xmllint --format - >$@.cache
|
||||
diff -q $@.cache $@ || mv $@.cache $@
|
||||
|
||||
all: generated_xml/wikievents.en.xml
|
||||
|
@ -1,32 +1,34 @@
|
||||
XSL_STYLESHEET := xhtml2xml.xsl
|
||||
.PHONY: all .FORCE
|
||||
.FORCE:
|
||||
all:
|
||||
|
||||
# For a correct generation of the link, use full path from this directory
|
||||
FILES := ../news/*/*.xhtml ../projects/*/*.xhtml
|
||||
# -----------------------------------------------------------------------------
|
||||
# remove xml files where original xhtml does not exist anymore
|
||||
# -----------------------------------------------------------------------------
|
||||
# note the reversal of target <-> prerequisite relationship
|
||||
# make will execute thew command for all xhtml files (targets) that
|
||||
# do not exist, in doing so it will not make the target, but rather
|
||||
# remove the xml file that generated it
|
||||
|
||||
# Trying to keep things readable
|
||||
ACTUAL_PREREQUISITE = ../$$(echo $* | sed -e 's,___,/,g').xhtml
|
||||
FIND_XHTML = ../$$(echo $$FILE | sed -e 's,___,/,g').xhtml
|
||||
TRANSFORM = xsltproc --stringparam link $$(echo $$FILE | sed -e 's,\.\.,,' | sed -e 's,..\.xhtml,html,') $(XSL_STYLESHEET) $$FILE > $@
|
||||
REMOVALS := $(subst ___,/,$(patsubst ./generated_xml/%.xml,../%.xhtml,$(wildcard ./generated_xml/*.xml)))
|
||||
../%.xhtml:
|
||||
rm generated_xml/$(subst /,___,$*).xml
|
||||
|
||||
# Select files
|
||||
sources := $(shell grep -l "<html newsdate" $(FILES))
|
||||
all_xmls := $(notdir $(basename $(wildcard ./generated_xml/*.xml)))
|
||||
all: $(REMOVALS)
|
||||
|
||||
# Create targets
|
||||
first_step = $(subst /,___, $(subst ../,, $(sources)))
|
||||
too_xml := $(addprefix ./generated_xml/, $(first_step:.xhtml=.xml))
|
||||
# -----------------------------------------------------------------------------
|
||||
# build includable xml files from all xhtml files that contain news
|
||||
# -----------------------------------------------------------------------------
|
||||
XMLNAMES := $(shell find ../ -name '*.xhtml' \
|
||||
| xargs grep -l "<html newsdate" \
|
||||
| sed -r 's;/;___;g; s;^\.\.___(.+)\.xhtml$$;./generated_xml/\1.xml;;' \
|
||||
)
|
||||
|
||||
XMLSOURCE = ../$(subst ___,/,$*).xhtml
|
||||
|
||||
.PHONY: all
|
||||
all: $(too_xml) remove_artifacts
|
||||
|
||||
generated_xml/%.xml: $(sources)
|
||||
FILE="$(ACTUAL_PREREQUISITE)"; if printf "%s" "$?" |grep -qF "$$FILE"; then $(TRANSFORM); fi
|
||||
|
||||
# Remove xml files for files thas are no longer in CVS
|
||||
.PHONY: remove_artifacts
|
||||
remove_artifacts:
|
||||
for FILE in $(all_xmls); do if [ ! -f $(FIND_XHTML) ]; then rm generated_xml/$$FILE.xml ; fi ; done
|
||||
|
||||
all: $(XMLNAMES)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
|
||||
generated_xml/%.xml: $$(XMLSOURCE) #xhtml2xml.xsl
|
||||
xsltproc --stringparam link /$(subst ___,/,$(basename $*)).html xhtml2xml.xsl $< > $@
|
||||
|
@ -1,32 +0,0 @@
|
||||
XSL_STYLESHEET := xhtml2xml.xsl
|
||||
|
||||
# For a correct generation of the link, use full path from this directory
|
||||
FILES := ../pdfreaders/*/*.xhtml ../projects/*/*.xhtml
|
||||
|
||||
# Trying to keep things readable
|
||||
ACTUAL_PREREQUISITE = ../$$(echo $* | sed -e 's,___,/,g').xhtml
|
||||
FIND_XHTML = ../$$(echo $$FILE | sed -e 's,___,/,g').xhtml
|
||||
TRANSFORM = xsltproc --stringparam link $$(echo $$FILE | sed -e 's,\.\.,,' | sed -e 's,..\.xhtml,html,') $(XSL_STYLESHEET) $$FILE > $@
|
||||
|
||||
# Select files
|
||||
sources := $(shell grep -l "<html newsdate" $(FILES))
|
||||
all_xmls := $(notdir $(basename $(wildcard ./generated_xml/*.xml)))
|
||||
|
||||
# Create targets
|
||||
first_step = $(subst /,___, $(subst ../,, $(sources)))
|
||||
too_xml := $(addprefix ./generated_xml/, $(first_step:.xhtml=.xml))
|
||||
|
||||
|
||||
.PHONY: all
|
||||
all: $(too_xml) remove_artifacts
|
||||
|
||||
generated_xml/%.xml: $(sources)
|
||||
for FILE in $?; do if [ "$$FILE" = "$(ACTUAL_PREREQUISITE)" ]; then $(TRANSFORM); else touch $@ ; fi; done
|
||||
|
||||
# Remove xml files for files thas are no longer in CVS
|
||||
.PHONY: remove_artifacts
|
||||
remove_artifacts:
|
||||
for FILE in $(all_xmls); do if [ ! -f $(FIND_XHTML) ]; then rm generated_xml/$$FILE.xml ; fi ; done
|
||||
|
||||
|
||||
|
@ -1,25 +0,0 @@
|
||||
|
||||
BASEDIR := $(shell dirname $(PWD))
|
||||
TAGMAP := $(shell find $(BASEDIR) -name '*.xml' \
|
||||
| xargs ../build/source_globber.sh map_tags \
|
||||
)
|
||||
|
||||
TAGNAMES = $(shell printf %s '$(TAGMAP)' \
|
||||
| cut -d" " -f2- \
|
||||
| tr ' ' '\n' \
|
||||
| egrep -v '[\$%/:()]' \
|
||||
| sort -u \
|
||||
| xargs printf 'tagmaps/%s.map ' \
|
||||
)
|
||||
|
||||
all: $(TAGNAMES)
|
||||
|
||||
MAPREQS = $(shell printf %s '$(TAGMAP)' \
|
||||
| sed -r 's;[^ ]+\...\.xml;\n&;g' \
|
||||
| grep ' $*' \
|
||||
| cut -d' ' -f1 \
|
||||
)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
tagmaps/%.map: $$(MAPREQS)
|
||||
printf '%s\n' $^ > $@
|
Loading…
Reference in New Issue
Block a user