aboutsummaryrefslogtreecommitdiffstats
path: root/tools/z80asm/Makefile
blob: b022c614e09fd06e86ef0fbe7fcbd809c6f8036e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Makefile for the Z80 assembler by shevek
# Copyright (C) 2002-2005  Bas Wijnen
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

CC	  = gcc
LDFLAGS   = -O2 -Wall
CFLAGS    = -O2 -Wall -Wwrite-strings -Wcast-qual -Wcast-align \
	    -Wstrict-prototypes -Wmissing-prototypes \
	    -Wmissing-declarations -Wredundant-decls -Wnested-externs \
	    -Winline -Wshadow -g -W -Ignulib
VERSION  ?= $(shell echo -n `cat VERSION | cut -d. -f1`. ; echo $$[`cat VERSION | cut -d. -f2` + 1])
ifneq (,$(findstring _NT,$(shell uname -s)))
O	  = obj
X	  = .exe
else
O	  = o
X	  =
endif

all: z80asm$(X)

z80asm$(X): z80asm.c Makefile gnulib/getopt.$(O) gnulib/getopt1.$(O)
	$(CC) $(CFLAGS) $(LDFLAGS) -DVERSION=\"$(shell cat VERSION)\" \
		$< gnulib/getopt.$(O) gnulib/getopt1.$(O) -o $@

gnulib/%.$(O): gnulib/%.c gnulib/getopt.h Makefile
	$(CC) $(CFLAGS) -c $< -o $@

clean:
	for i in . gnulib examples headers ; do \
		rm -f $$i/core $$i/*~ $$i/\#* $$i/*.$(O) $$i/*.rom ; \
	done
	rm -f z80asm$(X) z80asm.exe

dist: clean
	echo $(VERSION) > VERSION
	rm -rf /tmp/z80asm-$(VERSION) /tmp/z80asm
	tar cf - -C .. z80asm | tar xf - -C /tmp
	find /tmp/z80asm -name CVS | xargs rm -rf
	mv /tmp/z80asm /tmp/z80asm-$(VERSION)
	tar cvzf ../z80asm-$(VERSION).tar.gz -C /tmp z80asm-$(VERSION)