Skip to content

Commit

Permalink
simplify html generation and installation
Browse files Browse the repository at this point in the history
Simplify html generation and installation to the level automake
achieves:

  * "make" builds all $(html_DATA) files (amongst other things)
  * "make install" installs all $(html_DATA) files
  * "make html" has been kept to just build the $(html_DATA) files

Note

  * "make install-html" has been removed, as it does not install
    $(html_DATA) anyway with automake, but only the html generated
    from texi.
  • Loading branch information
ndim committed Jan 28, 2022
1 parent 5744091 commit 7c4c5f1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
# Built stuff
/dox/
/html/
/*.html
/beep-*.tar.gz
/beep-*.tar.xz

Expand Down
59 changes: 29 additions & 30 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -287,30 +287,36 @@ $(foreach exec,$(sbin_PROGRAMS), $(eval $(call LINK_RULE,$(exec),$(subst -,_,$(e
man1_DATA += beep.1
CLEANFILES += beep.1

html_DATA += html/CREDITS.html
html_DATA += html/NEWS.html
html_DATA += html/PERMISSIONS.html
html_DATA += html/README.html
CLEANFILES += CREDITS.html
CLEANFILES += NEWS.html
CLEANFILES += PERMISSIONS.html
CLEANFILES += README.html

CLEANFILES += html/pandoc.css
html_DATA += html/pandoc.css
CLEANFILES += DEVELOPMENT.html
CLEANFILES += INSTALL.html
CLEANFILES += PACKAGING.html

noinst_html_DATA += html/DEVELOPMENT.html
noinst_html_DATA += html/INSTALL.html
noinst_html_DATA += html/PACKAGING.html
ifeq (yes,$(shell if $(PANDOC) --version > /dev/null 2>&1; then echo yes; else echo no; fi))

.PHONY: html
html: $(html_DATA) $(noinst_html_DATA)
@$(MKDIR_P) html
html_DATA += pandoc.css

html_DATA += CREDITS.html
html_DATA += NEWS.html
html_DATA += PERMISSIONS.html
html_DATA += README.html

html/%.css: %.css
$(MKDIR_P) html
$(INSTALL) -p $< $@
noinst_html_DATA += DEVELOPMENT.html
noinst_html_DATA += INSTALL.html
noinst_html_DATA += PACKAGING.html

html/%.html: %.md | html/pandoc.css
@$(MKDIR_P) html
%.html: %.md
@echo PANDOC $< -o $@
$(PANDOC) --from gfm --to html --standalone -M pagetitle="$$($(SED) -n 1p $<)" -M title="" -c pandoc.css $< -o $@
endif

.PHONY: html
html: $(html_DATA) $(noinst_html_DATA)
all-local: $(html_DATA) $(noinst_html_DATA)

DEFAULT_FREQ = 440
DEFAULT_LENGTH = 200
Expand Down Expand Up @@ -389,16 +395,13 @@ check: tests/run-tests beep $(check_TARGETS)

.PHONY: clean
clean:
rm -f $(bin_PROGRAMS)
rm -f $(check_PROGRAMS)
rm -f $(sbin_PROGRAMS)
rm -f $(bin_PROGRAMS) $(sbin_PROGRAMS) $(check_PROGRAMS)
rm -f $(CLEANFILES)
rm -f *.dep
rm -rf .deps
rm -f *.lst *.gcc-lst
rm -f tests/*.new tests/*.actual
rm -rf dox
rm -rf html
rm -f *.o *.i *.s *.bc

.PHONY: doc
Expand Down Expand Up @@ -426,9 +429,9 @@ $(foreach dir,$(sort $(foreach d,$(dir-vars),$($(d)))),$(eval $(call make-instal
# Example:
# $(eval $(call install-file,installed-files-html,0644,htmldir,html/foobar.html))
define install-file
$(1) += $$(DESTDIR)$$($(3))/$$(notdir $(4))
$$(DESTDIR)$$($(3))/$$(notdir $(4)): $(4) | $$(DESTDIR)$$($(3))
$$(INSTALL) -p -m $(2) $$< $$@
installed-files += $$(DESTDIR)$$($(2))/$$(notdir $(3))
$$(DESTDIR)$$($(2))/$$(notdir $(3)): $(3) | $$(DESTDIR)$$($(2))
$$(INSTALL) -p -m $(1) $$< $$@
endef


Expand All @@ -439,7 +442,7 @@ endef
# $(eval $(call install-fileset,html_DATA,html))
define install-fileset
ifneq (,$$($(1)))
$$(foreach f,$$($(1)),$$(eval $$(call install-file,installed-files$$(if $(2),-$(2)),$$(if $$(filter PROGRAMS SCRIPTS,$$(lastword $$(subst _, ,$(1)))),0755,0644),$$(firstword $$(subst _, ,$(1)))dir,$$(f))))
$$(foreach f,$$($(1)),$$(eval $$(call install-file,$$(if $$(filter PROGRAMS SCRIPTS,$$(lastword $$(subst _, ,$(1)))),0755,0644),$$(firstword $$(subst _, ,$(1)))dir,$$(f))))
endif
endef

Expand All @@ -448,21 +451,17 @@ $(eval $(call install-fileset,bin_PROGRAMS))
$(eval $(call install-fileset,sbin_PROGRAMS))
$(eval $(call install-fileset,man1_DATA))
$(eval $(call install-fileset,doc_DATA))
$(eval $(call install-fileset,html_DATA,html))
$(eval $(call install-fileset,html_DATA))
$(eval $(call install-fileset,contrib_DATA))
$(eval $(call install-fileset,contrib_SCRIPTS))


.PHONY: install
install: all $(installed-files)

.PHONY: install-html
install-html: html $(installed-files-html)

.PHONY: uninstall
uninstall:
rm -f $(installed-files)
rm -f $(installed-files-html)


########################################################################
Expand Down

0 comments on commit 7c4c5f1

Please sign in to comment.