aboutsummaryrefslogtreecommitdiff
path: root/jindroush/Makefile
blob: 0a11a8f9c88c94737ca64ffb98215b235896dbaa (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
55
56
57
58
59
60
61
62
# Unified Makefile for Jindroush's various Atari 8-bit utilities

DESTDIR=
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
DOCDIR=$(PREFIX)/share/doc/jindroush_atari8_utils

MANDIR=$(PREFIX)/share/man
MAN1DIR=$(MANDIR)/man1

GZIP_MAN=y
RST2MAN=rst2man

BINS=acvt adir aext bas2boot chkbas chkexe chkrom

# The -Wno-write-strings prevents hundreds of "ISO C++ forbids
# converting a string to 'char*'" warnings. Eventually will fix.
W=-Wall -Wno-write-strings

all: libs manpages
	for i in $(BINS); do \
		make -C $$i COPT="$(COPT) $(W)" ; \
	done

manpages:
	make -C man

libs:
	make -C lib COPT="$(COPT) $(W)"

clean:
	make -C lib clean
	for i in $(BINS); do \
		make -C $$i clean ; \
	done

install: all
	mkdir -p $(DESTDIR)/$(BINDIR) $(DESTDIR)/$(DOCDIR) ; \
	cp README.txt $(DESTDIR)/$(DOCDIR)/README_jindroush.txt ; \
	cp gpl.txt $(DESTDIR)/$(DOCDIR)/gpl.txt ; \
	for i in $(BINS); do \
		strip $$i/$$i ; \
		cp $$i/$$i $(DESTDIR)/$(BINDIR)/$$i ; \
		chown root.root $$i/$$i $(DESTDIR)/$(BINDIR)/$$i 2>/dev/null || true ; \
		chmod 755 $(DESTDIR)/$(BINDIR)/$$i ; \
		cp $$i/readme.txt $(DESTDIR)/$(DOCDIR)/$$i.txt ; \
		chown root.root $(DESTDIR)/$(DOCDIR)/$$i.txt 2>/dev/null || true ; \
		chmod 644 $(DESTDIR)/$(DOCDIR)/$$i.txt ; \
	done ; \
	mkdir -p $(DESTDIR)/$(MAN1DIR) ; \
	for i in $(BINS); do \
		cp man/$$i.1 $(DESTDIR)/$(MAN1DIR) ; \
		chown root.root $(DESTDIR)/$(MAN1DIR)/$$i.1 2>/dev/null || true ; \
		chmod 644 $(DESTDIR)/$(MAN1DIR)/$$i.1 ; \
		[ "$(GZIP_MAN)" = "y" ] && gzip -f $(DESTDIR)/$(MAN1DIR)/$$i.1 ; \
	done
	ln -sf chkbas $(DESTDIR)$(BINDIR)/listbas
	if [ "$(GZIP_MAN)" = "y" ]; then \
		ln -sf chkbas.1.gz $(DESTDIR)$(MAN1DIR)/listbas.1.gz ; \
	else \
		ln -sf chkbas.1 $(DESTDIR)$(MAN1DIR)/listbas.1 ; \
	fi