Mercurial > projects > libpws
diff Makefile @ 1:e1309515d111
Add README file and manpages
author | Guido Berhoerster <guido+libpws@berhoerster.name> |
---|---|
date | Wed, 25 Mar 2015 17:10:23 +0100 |
parents | d541e748cfd8 |
children | 97097b4b6bfb |
line wrap: on
line diff
--- a/Makefile Tue Feb 10 11:29:54 2015 +0100 +++ b/Makefile Wed Mar 25 17:10:23 2015 +0100 @@ -45,6 +45,45 @@ PAX := pax GZIP := gzip SED := sed +XSLTPROC := xsltproc +DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl +DOCBOOK5_MANPAGES_FLAGS = --stringparam funcsynopsis.style 'ansi' \ + --stringparam man.authors.section.enabled 0 \ + --stringparam man.copyright.section.enabled 0 +DOCBOOK5_XHTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/xhtml/docbook.xsl +DOCBOOK5_XHTML_FLAGS = --stringparam funcsynopsis.style 'ansi' \ + --stringparam generate.consistent.ids 1 \ + --stringparam refentry.generate.name 1 \ + --stringparam refentry.generate.title 0 \ + --stringparam refentry.xref.manvolnum 1 \ + --stringparam generate.id.attributes 1 \ + --stringparam make.valid.html 1 \ + --stringparam make.clean.html 1 \ + --stringparam html.cleanup 1 \ + --stringparam html.longdesc 0 \ + --stringparam ulink.target '' \ + --stringparam docbook.css.source '' \ + --stringparam css.decoration 0 \ + --stringparam default.table.width '100%' + +define generate-manpage-rule = +$(addsuffix .%,$(basename $1)): $(addsuffix .%.xml,$(basename $(firstword $1))) docbook-update-source-data.xsl + $$(XSLTPROC) \ + --xinclude \ + --stringparam package $$(PACKAGE) \ + --stringparam version $$(VERSION) \ + docbook-update-source-data.xsl $$< | \ + $$(XSLTPROC) \ + --xinclude \ + --output $(firstword $1) \ + $$(DOCBOOK5_MANPAGES_FLAGS) \ + $$(DOCBOOK5_MANPAGES_STYLESHEET) \ + - + $$(SED) 's,^\.HP \\w.*$$$$,.HP 4n,' $$@ >$$(@).tmp && mv $$(@).tmp $$@ + for alias in $(wordlist 2,$(words $1),$1); do \ + ln -sf $(notdir $(firstword $1)) $$$$alias; \ + done +endef DESTDIR ?= prefix ?= /usr/local @@ -104,11 +143,78 @@ OBJS = $(LIBPWS_OBJS) +LIBPWS_MANPAGES = libpws.3 + +PWS_INIT_MANPAGES = pws_init.3 \ + pws_finalize.3 \ + pws_set_alloc_functions.3 \ + pws_generate_uuid.3 + +PWS3_FILE_CREATE_MANPAGES = pws3_file_create.3 \ + pws3_file_destroy.3 \ + pws3_file_get_error_code.3 \ + pws3_file_get_error_message.3 \ + pws3_file_read_mem.3 \ + pws3_file_read_stream.3 \ + pws3_file_write_mem.3 \ + pws3_file_write_stream.3 \ + pws3_file_set_header_field.3 \ + pws3_file_get_header_field.3 \ + pws3_file_remove_header_field.3 \ + pws3_file_insert_empty_group.3 \ + pws3_file_get_empty_group.3 \ + pws3_file_remove_empty_group.3 \ + pws3_file_first_empty_group.3 \ + pws3_file_last_empty_group.3 \ + pws3_file_next_empty_group.3 \ + pws3_file_prev_empty_group.3 \ + pws3_file_insert_record.3 \ + pws3_file_get_record.3 \ + pws3_file_remove_record.3 \ + pws3_file_first_record.3 \ + pws3_file_last_record.3 \ + pws3_file_next_record.3 \ + pws3_file_prev_record.3 \ + pws3_field_create.3 \ + pws3_field_destroy.3 \ + pws3_field_is_header.3 \ + pws3_field_get_type.3 \ + pws3_field_get_data_type.3 \ + pws3_field_set_uuid.3 \ + pws3_field_set_text.3 \ + pws3_field_set_time.3 \ + pws3_field_set_uint8.3 \ + pws3_field_set_uint16.3 \ + pws3_field_set_uint32.3 \ + pws3_field_set_bytes.3 \ + pws3_field_get_uuid.3 \ + pws3_field_get_text.3 \ + pws3_field_get_time.3 \ + pws3_field_get_uint8.3 \ + pws3_field_get_uint16.3 \ + pws3_field_get_uint32.3 \ + pws3_field_get_bytes.3 \ + pws3_record_create.3 \ + pws3_record_destroy.3 \ + pws3_record_set_field.3 \ + pws3_record_get_field.3 \ + pws3_record_remove_field.3 + +MANPAGES = $(LIBPWS_MANPAGES) \ + $(PWS_INIT_MANPAGES) \ + $(PWS3_FILE_CREATE_MANPAGES) + +XHTML_DOCUMENTATION = $(addsuffix .xhtml,$(firstword $(LIBPWS_MANPAGES)) \ + $(firstword $(PWS_INIT_MANPAGES)) \ + $(firstword $(PWS3_FILE_CREATE_MANPAGES))) + .DEFAULT_TARGET = all .PHONY: all clean clobber dist install -all: $(LIBPWS_LIB) +all: $(LIBPWS_LIB) $(MANPAGES) + +doc: $(MANPAGES) $(XHTML_DOCUMENTATION) XCPPFLAGS = -Iinclude ifeq ($(HAVE_ARC4RANDOM),1) @@ -146,6 +252,12 @@ $(LIBPWS_LIB): $(LIBPWS_LIB_MEMBERS) +$(eval $(call generate-manpage-rule,$(LIBPWS_MANPAGES))) + +$(eval $(call generate-manpage-rule,$(PWS_INIT_MANPAGES))) + +$(eval $(call generate-manpage-rule,$(PWS3_FILE_CREATE_MANPAGES))) + %.o: %.c $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d $(COMPILE.c) -o $@ $< @@ -154,16 +266,39 @@ $(AR) $(ARFLAGS) $@ $< $(RANLIB) $@ +%.xhtml: %.xml docbook-update-source-data.xsl + $(XSLTPROC) \ + --xinclude \ + --stringparam package $(PACKAGE) \ + --stringparam version $(VERSION) \ + docbook-update-source-data.xsl $< | \ + $(XSLTPROC) \ + --xinclude \ + --output $@ \ + $(DOCBOOK5_XHTML_FLAGS) \ + $(DOCBOOK5_XHTML_STYLESHEET) \ + - + install: for header in include/*.h; do \ $(INSTALL.data) $${header} \ - "$(DESTDIR)$(includedir)/$(PACKAGE)/$${header##*/}"; \ + "$(DESTDIR)$(includedir)/$${header##*/}"; \ done $(INSTALL.lib) $(LIBPWS_LIB) \ "$(DESTDIR)$(libdir)/$(notdir $(LIBPWS_LIB))" + for manpage in $(MANPAGES); do \ + if [ -L $${manpage} ]; then \ + $(INSTALL.link) $${manpage} \ + "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ + else \ + $(INSTALL.data) $${manpage} \ + "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ + fi \ + done clean: - rm -f $(LIBPWS_LIB) $(LIBPWS_OBJS) + rm -f $(LIBPWS_LIB) $(LIBPWS_OBJS) $(MANPAGES) \ + $(XHTML_DOCUMENTATION) clobber: clean rm -f $(patsubst %.o,%.d,$(OBJS))