| 1 | # |
| 2 | # the DASM macro assembler (aka small systems cross assembler) |
| 3 | # |
| 4 | # Copyright (c) 1988-2002 by Matthew Dillon. |
| 5 | # Copyright (c) 1995 by Olaf "Rhialto" Seibert. |
| 6 | # Copyright (c) 2003-2008 by Andrew Davie. |
| 7 | # Copyright (c) 2008 by Peter H. Froehlich. |
| 8 | # |
| 9 | # This program is free software; you can redistribute it and/or modify |
| 10 | # it under the terms of the GNU General Public License as published by |
| 11 | # the Free Software Foundation; either version 2 of the License, or |
| 12 | # (at your option) any later version. |
| 13 | # |
| 14 | # This program is distributed in the hope that it will be useful, |
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | # GNU General Public License for more details. |
| 18 | # |
| 19 | # You should have received a copy of the GNU General Public License along |
| 20 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 22 | |
| 23 | # Simple hack to build everything, test everything, make a beta |
| 24 | # distribution, or make a real distribution. Default is to just |
| 25 | # build everything. Installation is not implemented yet. |
| 26 | |
| 27 | # TODO: need to do documentation stuff as well; don't forget to |
| 28 | # delete automatically generated documentation in clean: below |
| 29 | |
| 30 | # just an alias for build really... |
| 31 | all: build |
| 32 | echo "Build complete, use 'make test' to run tests." |
| 33 | |
| 34 | # install, currently not implemented |
| 35 | install: build |
| 36 | echo "Installation not implemented, you're on your own, sorry." |
| 37 | |
| 38 | # just run all the tests |
| 39 | test: build |
| 40 | @echo "Running tests..." |
| 41 | (cd test; $(MAKE); cd ..) |
| 42 | @echo "Tests were run, but testing is not fully automated yet." |
| 43 | @echo "In other words, don't rely on what you saw too much." |
| 44 | |
| 45 | # just build everything and copy binaries to trunk/bin/ |
| 46 | build: |
| 47 | (cd src; $(MAKE); cd ..) |
| 48 | mkdir -p bin |
| 49 | cp src/dasm bin/dasm |
| 50 | cp src/ftohex bin/ftohex |
| 51 | |
| 52 | # release version to use for archive name |
| 53 | # supply this to make when you run it as |
| 54 | # RELEASE=2.20.12 |
| 55 | # on the command line, that's the easiest |
| 56 | # thing to do |
| 57 | RELEASE=unknown-version-number |
| 58 | # architecture for including binaries/executables |
| 59 | # supply this to make when you run it as |
| 60 | # BINARY=osx-ppc or BINARY=beos-x86 or ... |
| 61 | # on the command line, that's the easiest |
| 62 | # thing to do; note that this only affects |
| 63 | # the name of the archive, the binaries |
| 64 | # are always put into a trunk/bin folder |
| 65 | # if left empty, source distribution is assumed... |
| 66 | BINARY= |
| 67 | |
| 68 | # binaries |
| 69 | BINS=bin/* |
| 70 | # documentation |
| 71 | DOCS=AUTHORS ChangeLog LICENSE CREDITS NEWS README doc/* |
| 72 | # support files for various machines |
| 73 | MACS=machines/atari2600/* machines/channel-f/* |
| 74 | # source files for dasm and ftohex |
| 75 | SRCS=src/*.h src/*.c src/Makefile # src/TODO? src/HEADER? src/PATCHES? |
| 76 | # test files for dasm and ftohex |
| 77 | TSTS=test/*.asm test/*.bin.ref test/*.hex.ref test/Makefile test/run_tests.sh test/atari2600/Makefile test/atari2600/README test/atari2600/*.asm test/atari2600/*.ref |
| 78 | # other files |
| 79 | OTHS=Makefile |
| 80 | |
| 81 | ifeq ($(strip $(BINARY)),) |
| 82 | # source release, no binaries |
| 83 | CONTENTS=$(DOCS) $(MACS) $(SRCS) $(TSTS) $(OTHS) |
| 84 | DIRNAME=dasm-$(RELEASE) |
| 85 | ZIPNAME=dasm-$(RELEASE) |
| 86 | else |
| 87 | # binary release for specific platform |
| 88 | CONTENTS=$(BINS) $(DOCS) $(MACS) $(SRCS) $(TSTS) $(OTHS) |
| 89 | DIRNAME=dasm-$(RELEASE) |
| 90 | ZIPNAME=dasm-$(RELEASE)-$(BINARY) |
| 91 | endif |
| 92 | |
| 93 | # create a distribution archive for publication |
| 94 | dist: build |
| 95 | mkdir $(DIRNAME) |
| 96 | cp -p -r --parents $(CONTENTS) $(DIRNAME) |
| 97 | tar cvf - $(DIRNAME) | gzip -9 >$(ZIPNAME).tar.gz |
| 98 | # tar cvf - $(DIRNAME) | bzip2 -9 >$(ZIPNAME).tar.bz2 |
| 99 | rm -rf $(DIRNAME) |
| 100 | |
| 101 | # prepare a beta release containing source code and tests; |
| 102 | # machine files are included since tests may need them; |
| 103 | # nothing else is in the archive since it is not intended |
| 104 | # for the public, just designated volunteers |
| 105 | beta: |
| 106 | echo "This is an incomplete beta release of the DASM assembler." >README.BETA |
| 107 | echo "The purpose is to identify regressions, nothing more." >>README.BETA |
| 108 | echo "Please do *not* re-distribute this release in any form!" >>README.BETA |
| 109 | echo "Please do *not* distribute binaries derived from it either!" >>README.BETA |
| 110 | -tar zcvf dasm-beta-`date +%F`.tar.gz README.BETA $(MACS) $(OTHS) $(SRCS) $(TSTS) |
| 111 | rm -rf README.BETA |
| 112 | |
| 113 | # remove beta archives and bin/ directory created by |
| 114 | # regular build from this Makefile; don't delete the |
| 115 | # "real" distribution archives |
| 116 | clean: |
| 117 | (cd src; $(MAKE) clean; cd ..) |
| 118 | (cd test; $(MAKE) clean; cd ..) |
| 119 | -rm -rf dasm-beta-*.tar.gz bin/ |