From 4dcfc036c8d29a9c57f3181931448027aeea0ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrycjusz=20R=2E=20=C5=81ogiewa?= Date: Mon, 30 May 2016 17:42:01 +0200 Subject: [PATCH] samples zip and install targets moved into samples/Makefile as agreed --- Makefile | 17 +++++++++-------- libsrc/Makefile | 1 - samples/Makefile | 49 ++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index e0530e9f0..a10df8db0 100644 --- a/Makefile +++ b/Makefile @@ -3,21 +3,22 @@ .SUFFIXES: all mostlyclean clean install zip: - @$(MAKE) -C src --no-print-directory $@ - @$(MAKE) -C libsrc --no-print-directory $@ - @$(MAKE) -C doc --no-print-directory $@ + @$(MAKE) -C src --no-print-directory $@ + @$(MAKE) -C libsrc --no-print-directory $@ + @$(MAKE) -C doc --no-print-directory $@ + @$(MAKE) -C samples --no-print-directory $@ avail unavail bin: - @$(MAKE) -C src --no-print-directory $@ + @$(MAKE) -C src --no-print-directory $@ lib: - @$(MAKE) -C libsrc --no-print-directory $@ + @$(MAKE) -C libsrc --no-print-directory $@ doc: - @$(MAKE) -C doc --no-print-directory $@ + @$(MAKE) -C doc --no-print-directory $@ %65: - @$(MAKE) -C src --no-print-directory $@ + @$(MAKE) -C src --no-print-directory $@ %: - @$(MAKE) -C libsrc --no-print-directory $@ + @$(MAKE) -C libsrc --no-print-directory $@ diff --git a/libsrc/Makefile b/libsrc/Makefile index 549a7d4e9..99f120f3a 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -42,7 +42,6 @@ OUTPUTDIRS := lib \ asminc \ cfg \ include \ - samples \ $(subst ../,,$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)))\ $(subst ../,,$(wildcard ../target/*/drv/*))\ $(subst ../,,$(wildcard ../target/*/util))\ diff --git a/samples/Makefile b/samples/Makefile index 0cef19798..d9b51e827 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -12,20 +12,19 @@ SYS = c64 # source tree; otherwise, use the "install" directories. ifeq "$(wildcard ../src)" "" # No source tree -MOUS = /usr/lib/cc65/target/$(SYS)/drv/mou/$(SYS)*.mou -TGI = /usr/lib/cc65/target/$(SYS)/drv/tgi/$(SYS)*.tgi +installdir = /usr/lib/cc65 ifneq "$(wildcard /usr/local/lib/cc65)" "" -MOUS = /usr/local/lib/cc65/target/$(SYS)/drv/mou/$(SYS)*.mou -TGI = /usr/local/lib/cc65/target/$(SYS)/drv/tgi/$(SYS)*.tgi +installdir = /usr/local/lib/cc65 endif ifneq "$(wildcard /opt/local/share/cc65)" "" -MOUS = /opt/local/share/cc65/target/$(SYS)/drv/mou/$(SYS)*.mou -TGI = /opt/local/share/cc65/target/$(SYS)/drv/tgi/$(SYS)*.tgi +installdir = /opt/local/share/cc65 endif ifdef CC65_HOME -MOUS = $(CC65_HOME)/target/$(SYS)/drv/mou/$(SYS)*.mou -TGI = $(CC65_HOME)/target/$(SYS)/drv/tgi/$(SYS)*.tgi +installdir = $(CC65_HOME) endif + +MOUS = $(installdir)/target/$(SYS)/drv/mou/$(SYS)*.mou +TGI = $(installdir)/target/$(SYS)/drv/tgi/$(SYS)*.tgi CLIB = --lib $(SYS).lib CL = cl65 CC = cc65 @@ -109,8 +108,11 @@ EXELIST = ascii \ # -------------------------------------------------------------------------- # Rules to make the binaries -.PHONY: all -all: $(EXELIST) +.PHONY: all samples +all: + +samples: + $(EXELIST) # -------------------------------------------------------------------------- # Overlay rules. Overlays need special ld65 configuration files. Also, the @@ -138,9 +140,36 @@ samples.d64: all $(C1541) -attach $@ -write $$mod > /dev/null || exit $$?;\ done +# -------------------------------------------------------------------------- +# Installation rules + +INSTALL = install +samplesdir = $(prefix)/share/cc65 +.PHONY: install +install: + $(if $(prefix),,$(error variable `prefix' must be set)) + $(INSTALL) -d $(DESTDIR)$(samplesdir) + $(INSTALL) -d $(DESTDIR)$(samplesdir)/geos + $(INSTALL) -d $$(DESTDIR)$(samplesdir)/tutorial + $(INSTALL) -m0644 *.* $(DESTDIR)$(samplesdir) + $(INSTALL) -m0644 README $(DESTDIR)$(samplesdir) + $(INSTALL) -m0644 Makefile $(DESTDIR)$(samplesdir) + $(INSTALL) -m0644 geos/*.* $(DESTDIR)$(samplesdir)/geos + $(INSTALL) -m0644 tutorial/*.* $(DESTDIR)$(samplesdir)/tutorial + +# -------------------------------------------------------------------------- +# Packaging rules + +.PHONY: zip +zip: + @cd .. && zip -r cc65 samples/ + # -------------------------------------------------------------------------- # Clean-up rules +.PHONY: mostlyclean +mostlyclean: + .PHONY: clean clean: $(RM) *~ *.map *.o *.s *.lbl