aboutsummaryrefslogtreecommitdiff
## C program
localstate_lib = $(localstatedir)/lib
localstate_hydrilla = $(localstate_lib)/hydrilla
export contentdir = $(localstate_hydrilla)/content

SUBDIRS = src

# data files
dist_doc_DATA = README.txt copyright
EXTRA_DIST = examples licenses content_README.txt.in
CLEANFILES = content_README.txt

install_doc: $(srcdir)/examples $(srcdir)/licenses
	cd $(srcdir) && for D in `find examples licenses -type d`; do \
		$(MKDIR_P) $(DESTDIR)/$(docdir)/"$$D"; \
	done
	cd $(srcdir) && for F in `find examples licenses -type f`; do \
		$(INSTALL_DATA) "$$F" $(DESTDIR)/$(docdir)/"$$F"; \
	done

uninstall_doc:
	rm -rf $(DESTDIR)/$(docdir)/examples $(DESTDIR)/$(docdir)/licenses
	-rmdir $(DESTDIR)/$(docdir)

content_README.txt: $(srcdir)/content_README.txt.in $(srcdir)/Makefile
	$(subst_perform) < $< > $@

install_content_readme: $(srcdir)/content_README.txt
	$(MKDIR_P) $(DESTDIR)/$(contentdir)
	$(INSTALL_DATA) $< $(DESTDIR)/$(contentdir)/README.txt

uninstall_content_readme:
	rm -rf $(DESTDIR)/$(contentdir)/README.txt
	-rmdir $(DESTDIR)/$(contentdir)
	-rmdir $(DESTDIR)/$(localstate_hydrilla)
	-rmdir $(DESTDIR)/$(localstate_lib)

all all-recursive: $(srcdir)/content_README.txt

install-data-local: install_doc install_content_readme
uninstall-local: uninstall_doc uninstall_content_readme

.PHONY: install-doc install_content_readme uninstall-doc \
	uninstall_content_readme

## init scripts
transform_name = @program_transform_name@
hydrilla_new_name = `echo hydrilla | sed '$(transform_name)'`
subst_perform = sed -e 's|[@]hydrilla[@]|'$(hydrilla_new_name)'|g' \
		-e 's|[@]bindir[@]|$(bindir)|g' \
		-e 's|[@]runstatedir[@]|$(runstatedir)|g' \
		-e 's|[@]logdir[@]|$(localstatedir)/log|g' \
		-e 's|[@]contentdir[@]|$(contentdir)/log|g' \
		-e 's|[@]docdir[@]|$(docdir)|g'

# SysV init script
CLEANFILES += daemon/sysv
EXTRA_DIST += daemon/sysv.in

$(srcdir)/daemon/sysv: $(srcdir)/daemon/sysv.in $(srcdir)/Makefile
	$(subst_perform) < $< > $@

sysv_script_dest_loc = $(DESTDIR)/etc/init.d
sysv_script_dest_path = $(sysv_script_dest_loc)/$(hydrilla_new_name)

install-sysv-script: $(srcdir)/daemon/sysv
	$(MKDIR_P) $(sysv_script_dest_loc)
	$(INSTALL_SCRIPT) $< $(sysv_script_dest_path)

uninstall-sysv-script:
	rm -f $(sysv_script_dest_path)

all all-recursive: $(srcdir)/daemon/sysv

install-exec-local: install-sysv-script
uninstall-local: uninstall-sysv-script

.PHONY: install-sysv-script uninstall-sysv-script