File: Makefile

package info (click to toggle)
hoichess 0.10.3-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 792 kB
  • ctags: 1,686
  • sloc: cpp: 15,262; makefile: 214; sh: 11
file content (122 lines) | stat: -rw-r--r-- 3,506 bytes parent folder | download | duplicates (3)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# $Id: Makefile 1462 2007-12-18 20:49:56Z holger $

# Make these variables also available to sub-makes.
export top_srcdir = $(shell pwd)
export prefix = /usr
export bindir = $(prefix)/games
export mandir = $(prefix)/share/man


VERSION = $(shell grep '^Version' ChangeLog | head -n 1 | awk '{ print $$2; }')



.PHONY: all
all: hoichess.6 hoichess.6.html
	$(MAKE) -C src all

hoichess.6: hoichess.6.pod
	pod2man -n hoichess -s 6 -r hoichess-0.3 -c Games $< $@

hoichess.6.html: hoichess.6.pod
	pod2html --title "HoiChess" $< > $@
	

.PHONY: install 
install: all
	$(MAKE) -C src install
	install -m 644 -D hoichess.6 $(DESTDIR)$(mandir)/man6/hoichess.6

.PHONY: clean
clean:
	$(MAKE) -C src PLATFORM=unix clean
	$(MAKE) -C src PLATFORM=mingw32 clean
	$(MAKE) -C src PLATFORM=win32 clean
	rm -f hoichess.6 hoichess.6.html
	rm -f *.tmp
	rm -rf dist

.PHONY: maintainer-clean
maintainer-clean: clean
	$(MAKE) -C src maintainer-clean


###############################################################################
#
# Definitions and targets to build source and binary distributions
#
###############################################################################

DIST_SRC_NAME		= hoichess-$(VERSION)
DIST_MINGW32_NAME	= hoichess-$(VERSION)-mingw32
DIST_WIN32_NAME		= hoichess-$(VERSION)-win32

DIST_SRC_SOURCES	= AUTHORS BUGS ChangeLog LICENSE README \
				Makefile hoichess.6.pod \
				src/Makefile src/Makefile.local \
				$(wildcard src/*.cc src/*.h) \
				$(wildcard src/*/*.cc src/*/*.h) \
				$(wildcard src/*/*/*.cc src/*/*/*.h) \
				$(wildcard src/build/*)

DIST_SRC_NONSOURCES	= hoichess.6 hoichess.6.html

DIST_MINGW32_SOURCES	= AUTHORS BUGS ChangeLog LICENSE README
DIST_MINGW32_NONSOURCES	= hoichess.6 hoichess.6.html
DIST_MINGW32_BINS	= src/.build-mingw32/hoichess.exe \
			  src/.build-mingw32/hoixiangqi.exe

DIST_WIN32_SOURCES	= AUTHORS BUGS ChangeLog LICENSE README
DIST_WIN32_NONSOURCES	= hoichess.6.html
DIST_WIN32_BINS		= src/.build-win32/hoichess.exe \
			  src/.build-win32/hoixiangqi.exe


.PHONY: dist dist-src
dist dist-src: $(DIST_SRC_NONSOURCES)
	mkdir -p dist
	
	rm -rf dist/$(DIST_SRC_NAME)
	mkdir dist/$(DIST_SRC_NAME)
	cp --parents $(DIST_SRC_SOURCES)	dist/$(DIST_SRC_NAME)
	cp --parents $(DIST_SRC_NONSOURCES)	dist/$(DIST_SRC_NAME)
	
	rm -f dist/$(DIST_SRC_NAME).tar.gz
	cd dist && tar -czf $(DIST_SRC_NAME).tar.gz $(DIST_SRC_NAME)
	rm -f dist/$(DIST_SRC_NAME).zip
	cd dist && zip -q -9 -r $(DIST_SRC_NAME).zip $(DIST_SRC_NAME)


.PHONY: $(DIST_MINGW32_BINS)
$(DIST_MINGW32_BINS):
	$(MAKE) -C src PLATFORM=mingw32

.PHONY: dist-mingw32
dist-mingw32: $(DIST_MINGW32_NONSOURCES) $(DIST_MINGW32_BINS)
	mkdir -p dist
	
	rm -rf dist/$(DIST_MINGW32_NAME)
	mkdir dist/$(DIST_MINGW32_NAME)
	cp --parents $(DIST_MINGW32_SOURCES)	dist/$(DIST_MINGW32_NAME)
	cp --parents $(DIST_MINGW32_NONSOURCES)	dist/$(DIST_MINGW32_NAME)
	mkdir dist/$(DIST_MINGW32_NAME)/bin
	cp $(DIST_MINGW32_BINS) 		dist/$(DIST_MINGW32_NAME)/bin
	
	rm -f dist/$(DIST_MINGW32_NAME).zip
	cd dist && zip -q -9 -r $(DIST_MINGW32_NAME).zip $(DIST_MINGW32_NAME)


.PHONY: dist-win32
dist-win32: $(DIST_WIN32_NONSOURCES)
	mkdir -p dist
	
	rm -rf dist/$(DIST_WIN32_NAME)
	mkdir dist/$(DIST_WIN32_NAME)
	cp --parents $(DIST_WIN32_SOURCES)	dist/$(DIST_WIN32_NAME)
	cp --parents $(DIST_WIN32_NONSOURCES)	dist/$(DIST_WIN32_NAME)
	mkdir dist/$(DIST_WIN32_NAME)/bin
	cp $(DIST_WIN32_BINS) 			dist/$(DIST_WIN32_NAME)/bin
	
	rm -f dist/$(DIST_WIN32_NAME).zip
	cd dist && zip -q -9 -r $(DIST_WIN32_NAME).zip $(DIST_WIN32_NAME)