
SRCPATH=$(VPATH)/
ifeq ($(TOPDIR),)
TOPDIR=..
BUILD=..
endif

include $(TOPDIR)/Rules.mak

CONFIG_OBJ = dn.txt oids.txt eku.txt

misc all: $(CONFIG_OBJ)

MSG := \# Do not edit this file, rather use

%.txt: %.text
	@$(PRINT) "  GEN    [$(BASENAME)] $@"
ifeq ($(HOST), w32)
	(echo "$(MSG) PROFILE\Application Data\xca\$@" && cat $^) | sed 's/$$/\r/' > $@
else ifneq ($(DARWIN),)
	(echo "$(MSG) HOME/Library/Preferences/xca/$@" && cat $^) > $@
else
	(echo "$(MSG) /etc/xca/$@ or HOME/.xca/$@" && cat $^) > $@
endif


install:
	install -m 755 -d $(destdir)$(xca_prefix) \
		$(destdir)$(datarootdir)/applications \
		$(destdir)$(datarootdir)/mime/packages
	install -m 644 $(CONFIG_OBJ) $(SRCPATH)*.xca \
			$(destdir)$(xca_prefix)
	install -m 644 $(SRCPATH)xca.desktop $(destdir)$(datarootdir)/applications
	install -m 644 $(SRCPATH)xca.xml $(destdir)$(datarootdir)/mime/packages
	if test -z "$(destdir)"; then \
	  update-mime-database $(datarootdir)/mime || :; \
	  update-desktop-database || :; \
	fi

app:
	mkdir -p $(APPDIR)/Resources
	install -m 644 $(SRCPATH)Info.plist $(SRCPATH)PkgInfo $(APPDIR)
	install -m 644 $(CONFIG_OBJ) $(SRCPATH)*.xca $(APPDIR)/Resources

