Added 'install' target.

The 'install' target primarily aims to support pacaking tools. Therefore...
- It just presumes a "capable" install program to be present.
- There's intentionally no 'uninstall' target.
This commit is contained in:
Oliver Schmidt
2014-01-29 21:42:26 +01:00
parent 4452156d1a
commit e320fe3db8
3 changed files with 42 additions and 17 deletions

View File

@@ -50,10 +50,18 @@ endif
.SUFFIXES:
.PHONY: all lib $(TARGETS) mostlyclean clean
.PHONY: all lib $(TARGETS) mostlyclean clean install
ifndef TARGET
datadir = $(prefix)/share/cc65
INSTALLDIRS = ../asminc ../cfg ../include \
$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)) \
../lib ../targetutil $(addprefix ../,$(DRVTYPES))
INSTALL = install
all lib: $(TARGETS)
$(TARGETS):
@@ -65,6 +73,21 @@ mostlyclean:
clean:
$(call RMDIR,../wrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES)))
install:
$(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe))
##########
define INSTALL_recipe
$(if $(prefix),,$(error variable `prefix' must be set))
$(INSTALL) -d $(subst ..,$(DESTDIR)$(datadir),$(dir))
$(INSTALL) -m644 $(dir)/* $(subst ..,$(DESTDIR)$(datadir),$(dir))
endef
##########
else # TARGET
CA65FLAGS =