From 551f6da41f1848700a9eff04d3d995ee7fb6f483 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Fri, 27 Nov 2020 18:36:28 +0100 Subject: [PATCH 1/7] Makefile: Implement installation of binaries --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ce0f01a0..fbcf3cae 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ # Simple hack to build everything, test everything, make a beta # distribution, or make a real distribution. Default is to just -# build everything. Installation is not implemented yet. +# build everything. # TODO: need to do documentation stuff as well; don't forget to # delete automatically generated documentation in clean: below @@ -31,9 +31,14 @@ all: build echo "Build complete, use 'make test' to run tests." -# install, currently not implemented -install: build - echo "Installation not implemented, you're on your own, sorry." +DESTDIR = +prefix = /usr/local +bindir = ${prefix}/bin +.PHONY: install install-bin +install: install-bin +install-bin: build + install -d ${DESTDIR}${bindir} + install -m555 ${BINS} ${DESTDIR}${bindir} # just run all the tests test: build From eaa74c2bb80f2dbcd210cec99c5f1a1e2f70a935 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Fri, 27 Nov 2020 18:36:29 +0100 Subject: [PATCH 2/7] Makefile: Use make's -C to change dir --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index fbcf3cae..4d78fa40 100644 --- a/Makefile +++ b/Makefile @@ -43,13 +43,13 @@ install-bin: build # just run all the tests test: build @echo "Running tests..." - (cd test; $(MAKE); cd ..) + @${MAKE} -C test @echo "Tests were run, but testing is not fully automated yet." @echo "In other words, don't rely on what you saw too much." # just build everything and copy binaries to trunk/bin/ build: - (cd src; $(MAKE); cd ..) + @${MAKE} -C src mkdir -p bin cp src/dasm bin/dasm cp src/ftohex bin/ftohex @@ -119,6 +119,6 @@ beta: # regular build from this Makefile; don't delete the # "real" distribution archives clean: - (cd src; $(MAKE) clean; cd ..) - (cd test; $(MAKE) clean; cd ..) + @${MAKE} -C src $@ + @${MAKE} -C test $@ -rm -rf dasm-beta-*.tar.gz bin/ From 5f56a2216b5a68f100f7baf8c2e21d6ea1c60bad Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Fri, 27 Nov 2020 18:36:52 +0100 Subject: [PATCH 3/7] Makefile: Replace wildcard in BINS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4d78fa40..c22f1fca 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,7 @@ RELEASE=unknown-version-number BINARY= # binaries -BINS=bin/* +BINS = bin/dasm bin/ftohex # documentation DOCS=AUTHORS ChangeLog LICENSE CREDITS NEWS README doc/* # support files for various machines From ad50182062d1cdd1ffaedacb0e14a56d85bc2400 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Fri, 27 Nov 2020 18:40:22 +0100 Subject: [PATCH 4/7] Makefile: Simplify binary release spec --- Makefile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index c22f1fca..842e61e1 100644 --- a/Makefile +++ b/Makefile @@ -83,16 +83,14 @@ TSTS=test/*.asm test/*.bin.ref test/*.hex.ref test/Makefile test/run_tests.sh te # other files OTHS=Makefile -ifeq ($(strip $(BINARY)),) # source release, no binaries CONTENTS=$(DOCS) $(MACS) $(SRCS) $(TSTS) $(OTHS) DIRNAME=dasm-$(RELEASE) ZIPNAME=dasm-$(RELEASE) -else +ifneq ($(strip $(BINARY)),) # binary release for specific platform -CONTENTS=$(BINS) $(DOCS) $(MACS) $(SRCS) $(TSTS) $(OTHS) -DIRNAME=dasm-$(RELEASE) -ZIPNAME=dasm-$(RELEASE)-$(BINARY) +CONTENTS += ${BINS} +ZIPNAME := ${ZIPNAME}-${BINARY} endif # create a distribution archive for publication From 32d9001f6f4b0739e356dfe7f7f3fd9e196c6d6f Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Fri, 27 Nov 2020 20:35:34 +0100 Subject: [PATCH 5/7] Makefile: Fix double echoing on rule --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 842e61e1..a90daf86 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ # just an alias for build really... all: build - echo "Build complete, use 'make test' to run tests." + @echo "Build complete, use 'make test' to run tests." DESTDIR = prefix = /usr/local From 108eaeba314f08a3beffeecbfa49d90687c0f46d Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Sun, 29 Nov 2020 20:04:21 +0100 Subject: [PATCH 6/7] Makefile: Install man pages --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a90daf86..0aa4e181 100644 --- a/Makefile +++ b/Makefile @@ -34,12 +34,20 @@ all: build DESTDIR = prefix = /usr/local bindir = ${prefix}/bin -.PHONY: install install-bin -install: install-bin +mandir = ${prefix}/share/man +man1dir = ${mandir}/man1 + +.PHONY: install install-bin install-man +install: install-bin install-man install-bin: build install -d ${DESTDIR}${bindir} install -m555 ${BINS} ${DESTDIR}${bindir} +man1pages = docs/dasm.1 +install-man: ${man1pages} + install -d ${DESTDIR}${man1dir} + install -m444 ${man1pages} ${DESTDIR}${man1dir} + # just run all the tests test: build @echo "Running tests..." From 9fdbb5c72e139cd42362bd1ba4535b2984f73e65 Mon Sep 17 00:00:00 2001 From: Ismael Luceno Date: Sun, 29 Nov 2020 20:14:19 +0100 Subject: [PATCH 7/7] Makefile: Mark clean, beta and dist targets as phony --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 0aa4e181..b98fc79b 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,7 @@ ZIPNAME := ${ZIPNAME}-${BINARY} endif # create a distribution archive for publication +.PHONY: dist dist: build mkdir $(DIRNAME) cp -p -r --parents $(CONTENTS) $(DIRNAME) @@ -113,6 +114,7 @@ dist: build # machine files are included since tests may need them; # nothing else is in the archive since it is not intended # for the public, just designated volunteers +.PHONY: beta beta: echo "This is an incomplete beta release of the DASM assembler." >README.BETA echo "The purpose is to identify regressions, nothing more." >>README.BETA @@ -124,6 +126,7 @@ beta: # remove beta archives and bin/ directory created by # regular build from this Makefile; don't delete the # "real" distribution archives +.PHONY: clean clean: @${MAKE} -C src $@ @${MAKE} -C test $@