Skip to content

Commit 7c4c5f1

Browse files
committed
simplify html generation and installation
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.
1 parent 5744091 commit 7c4c5f1

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
# Built stuff
3232
/dox/
3333
/html/
34+
/*.html
3435
/beep-*.tar.gz
3536
/beep-*.tar.xz
3637

GNUmakefile

+29-30
Original file line numberDiff line numberDiff line change
@@ -287,30 +287,36 @@ $(foreach exec,$(sbin_PROGRAMS), $(eval $(call LINK_RULE,$(exec),$(subst -,_,$(e
287287
man1_DATA += beep.1
288288
CLEANFILES += beep.1
289289

290-
html_DATA += html/CREDITS.html
291-
html_DATA += html/NEWS.html
292-
html_DATA += html/PERMISSIONS.html
293-
html_DATA += html/README.html
290+
CLEANFILES += CREDITS.html
291+
CLEANFILES += NEWS.html
292+
CLEANFILES += PERMISSIONS.html
293+
CLEANFILES += README.html
294294

295-
CLEANFILES += html/pandoc.css
296-
html_DATA += html/pandoc.css
295+
CLEANFILES += DEVELOPMENT.html
296+
CLEANFILES += INSTALL.html
297+
CLEANFILES += PACKAGING.html
297298

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

302-
.PHONY: html
303-
html: $(html_DATA) $(noinst_html_DATA)
304-
@$(MKDIR_P) html
301+
html_DATA += pandoc.css
302+
303+
html_DATA += CREDITS.html
304+
html_DATA += NEWS.html
305+
html_DATA += PERMISSIONS.html
306+
html_DATA += README.html
305307

306-
html/%.css: %.css
307-
$(MKDIR_P) html
308-
$(INSTALL) -p $< $@
308+
noinst_html_DATA += DEVELOPMENT.html
309+
noinst_html_DATA += INSTALL.html
310+
noinst_html_DATA += PACKAGING.html
309311

310-
html/%.html: %.md | html/pandoc.css
311-
@$(MKDIR_P) html
312+
%.html: %.md
312313
@echo PANDOC $< -o $@
313314
$(PANDOC) --from gfm --to html --standalone -M pagetitle="$$($(SED) -n 1p $<)" -M title="" -c pandoc.css $< -o $@
315+
endif
316+
317+
.PHONY: html
318+
html: $(html_DATA) $(noinst_html_DATA)
319+
all-local: $(html_DATA) $(noinst_html_DATA)
314320

315321
DEFAULT_FREQ = 440
316322
DEFAULT_LENGTH = 200
@@ -389,16 +395,13 @@ check: tests/run-tests beep $(check_TARGETS)
389395

390396
.PHONY: clean
391397
clean:
392-
rm -f $(bin_PROGRAMS)
393-
rm -f $(check_PROGRAMS)
394-
rm -f $(sbin_PROGRAMS)
398+
rm -f $(bin_PROGRAMS) $(sbin_PROGRAMS) $(check_PROGRAMS)
395399
rm -f $(CLEANFILES)
396400
rm -f *.dep
397401
rm -rf .deps
398402
rm -f *.lst *.gcc-lst
399403
rm -f tests/*.new tests/*.actual
400404
rm -rf dox
401-
rm -rf html
402405
rm -f *.o *.i *.s *.bc
403406

404407
.PHONY: doc
@@ -426,9 +429,9 @@ $(foreach dir,$(sort $(foreach d,$(dir-vars),$($(d)))),$(eval $(call make-instal
426429
# Example:
427430
# $(eval $(call install-file,installed-files-html,0644,htmldir,html/foobar.html))
428431
define install-file
429-
$(1) += $$(DESTDIR)$$($(3))/$$(notdir $(4))
430-
$$(DESTDIR)$$($(3))/$$(notdir $(4)): $(4) | $$(DESTDIR)$$($(3))
431-
$$(INSTALL) -p -m $(2) $$< $$@
432+
installed-files += $$(DESTDIR)$$($(2))/$$(notdir $(3))
433+
$$(DESTDIR)$$($(2))/$$(notdir $(3)): $(3) | $$(DESTDIR)$$($(2))
434+
$$(INSTALL) -p -m $(1) $$< $$@
432435
endef
433436

434437

@@ -439,7 +442,7 @@ endef
439442
# $(eval $(call install-fileset,html_DATA,html))
440443
define install-fileset
441444
ifneq (,$$($(1)))
442-
$$(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))))
445+
$$(foreach f,$$($(1)),$$(eval $$(call install-file,$$(if $$(filter PROGRAMS SCRIPTS,$$(lastword $$(subst _, ,$(1)))),0755,0644),$$(firstword $$(subst _, ,$(1)))dir,$$(f))))
443446
endif
444447
endef
445448

@@ -448,21 +451,17 @@ $(eval $(call install-fileset,bin_PROGRAMS))
448451
$(eval $(call install-fileset,sbin_PROGRAMS))
449452
$(eval $(call install-fileset,man1_DATA))
450453
$(eval $(call install-fileset,doc_DATA))
451-
$(eval $(call install-fileset,html_DATA,html))
454+
$(eval $(call install-fileset,html_DATA))
452455
$(eval $(call install-fileset,contrib_DATA))
453456
$(eval $(call install-fileset,contrib_SCRIPTS))
454457

455458

456459
.PHONY: install
457460
install: all $(installed-files)
458461

459-
.PHONY: install-html
460-
install-html: html $(installed-files-html)
461-
462462
.PHONY: uninstall
463463
uninstall:
464464
rm -f $(installed-files)
465-
rm -f $(installed-files-html)
466465

467466

468467
########################################################################

0 commit comments

Comments
 (0)