forked from cymonsgames/ASCIIpOrtal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.default
172 lines (129 loc) · 5.1 KB
/
Makefile.default
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# Default Makefile for ASCIIpOrtal
# It compiles pdcurses for SDL locally, use 'linux32' or 'linux64' target if it
# is already available on your system.
# Note that for release, the 'dist' target of this Makefile is not suitable:
# use target 'all' from the main Makefile instead.
include Makefile.common
PORT = default
### Custom variables ###
PDCURSES_DIR = PDCurses-$(PDCURSES_VER)
PDCURSES_VER = 3.4
YAML-CPP_VER = 0.5.3
### Customisable variables ###
# Custom base name: everything (binary, tarballs) will be built using this base name.
# Unless heavy changes in the codebase (eg. a mod), you should use DISTNAME instead.
#ASCIIPORTAL := $(ASCIIPORTAL)-mod
# Custom base name for release (tarball). Keeping '-$(PORT)' is generally a good option,
# but feel free to change it.
#DISTNAME := $(DISTNAME)-$(PORT)
# This should pick up the local version of pdcurses_SDL
CXXFLAGS := $(CXXFLAGS) -I yaml-cpp/include -I ./$(PDCURSES_DIR) -I ./$(PDCURSES_DIR)/sdl1 `sdl-config --cflags` -U__NOSDL__ -U__NOSOUND__ -U__DINGOO__ -U__GP2X__
# Custom link flags
LINKFLAGS := -L yaml-cpp $(LINKFLAGS) $(PDCURSES_DIR)/sdl1/libpdcurses.a `sdl-config --libs` -L/usr/lib -l SDL_mixer
# Additional files to be included in release tarball.
#FILES_INCLUDE_DIST := $(FILES_INCLUDE_DIST) custom_readme.txt example.dll foo/bar.xml
### Required variables ###
# C++ compiler. You might want to change this for cross-compilation.
CXX = g++
# Tarball name for release. You should not edit anything excepted the extension,
# see DISTNAME above.
#TARBALL = $(DISTNAME).zip
TARBALL = $(DISTNAME).tar.gz
TARBALL_SRC = $(DISTNAME)-src.tar.gz
# hard-coded at the moment (because of the '-' in the name)
TARBALL_DEB = asciiportal_1.3.orig.tar.gz
# Final executable name. Same thing, you should only edit the extension.
#EXE_NAME = $(ASCIIPORTAL).exe
EXE_NAME = $(ASCIIPORTAL)
### Required targets ###
# Dummy target if called directly
wrong-way:
@echo
@echo "[*] This Makefile is not intended to be run directly."
@echo "[*] Instead, call the main Makefile with the proper target!"
@echo "[*] In most cases, a simple 'make' should work though."
# Targets called by the main Makefile:
$(PORT):
$(MAKE) -f Makefile.$(PORT) almostclean execlean
$(MAKE) -f Makefile.$(PORT) $(EXE_NAME)
dist:
$(MAKE) -f Makefile.$(PORT) almostclean execlean distclean saveclean
$(MAKE) -f Makefile.$(PORT) $(TARBALL)
$(MAKE) -f Makefile.$(PORT) clean execlean
all:
$(MAKE) -f Makefile.$(PORT) dist
# This is supposed to work out-of-the-box
%.o: src/%.cpp yaml-cpp
$(CXX) -c $(CXXFLAGS) $<
# Replace by OBJECTS_NOSOUND if needed
$(EXE_NAME): yaml-cpp/libyaml-cpp.a $(PDCURSES_DIR)/sdl1/libpdcurses.a $(OBJECTS)
$(CXX) $^ $(LINKFLAGS) -o $@
@echo
@echo "[*] $(EXE_NAME) successfully built."
# You might want to add additional targets here (see 'Makefile.mingw32')
$(TARBALL): $(EXE_NAME)
mkdir $(DISTNAME)
cp -r $(EXE_NAME) $(FILES_INCLUDE_DIST) $(DISTNAME)
# zip -r $@ $(DISTNAME) # zip is bad, but anyway...
tar czf $@ $(DISTNAME) # tar.gz
# tar cjf $@ $(DISTNAME) # tar.bz2
# tar cJf $@ $(DISTNAME) # tar.xz
rm -rf $(DISTNAME)
# This is only to test if the tarball was really generated
ls $(TARBALL)
@echo
@echo "[*] $(TARBALL) successfully generated."
# This is supposed to clean anything you've added/compiled, excepted the
# main executable
clean:
rm -f *.o
rm -rf $(PDCURSES_DIR)
rm -f PDCurses-$(PDCURSES_VER).tar.gz
almostclean:
rm -f *.o
# Clean the generated executable
execlean:
rm -f $(EXE_NAME)
# Clean the generated tarball
distclean:
rm -f $(TARBALL)
rm -f $(TARBALL_SRC)
### Custom targets ###
# This is for targets you would need somewhere. Again, see 'Makefile.mingw32'
# for an example
install: saveclean
mkdir -p $(DESTDIR)/usr/share/asciiportal
mkdir -p $(DESTDIR)/usr/share/doc/asciiportal
mkdir -p $(DESTDIR)/usr/bin
cp -r media/ maps/ $(DESTDIR)/usr/share/asciiportal/
cp README CHANGELOG $(DESTDIR)/usr/share/doc/asciiportal/
cp $(EXE_NAME) $(DESTDIR)/usr/bin/
chmod 0644 $(DESTDIR)/usr/share/doc/asciiportal/*
chmod 0755 $(DESTDIR)/usr/bin/$(EXE_NAME)
$(TARBALL_SRC):
mkdir $(DISTNAME)-src
cp -r $(FILES_INCLUDE_SRC) $(DISTNAME)-src
# zip -r $(TARBALL_SRC) $(DISTNAME)-src # zip is bad, but anyway...
tar czf $(TARBALL_SRC) $(DISTNAME)-src # tar.gz
# tar cjf $(TARBALL_SRC) $(DISTNAME)-src # tar.bz2
# tar cJf $(TARBALL_SRC) $(DISTNAME)-src # tar.xz
rm -rf $(DISTNAME)-src
source:
$(MAKE) -f Makefile.$(PORT) clean distclean execlean saveclean
$(MAKE) -f Makefile.$(PORT) $(TARBALL_SRC)
debian-source: $(TARBALL_SRC)
cp $(TARBALL_SRC) asciiportal_1.3.orig.tar.gz
$(PDCURSES_DIR)/sdl1/libpdcurses.a: $(PDCURSES_DIR)
cd `dirname $@` && make libs
$(PDCURSES_DIR): PDCurses-$(PDCURSES_VER).tar.gz
tar xvfz $<
PDCurses-$(PDCURSES_VER).tar.gz:
wget http://sourceforge.net/projects/pdcurses/files/pdcurses/$(PDCURSES_VER)/PDCurses-$(PDCURSES_VER).tar.gz
yaml-cpp/libyaml-cpp.a: yaml-cpp
cd yaml-cpp && cmake .
cd yaml-cpp && make yaml-cpp
yaml-cpp: yaml-cpp-$(YAML-CPP_VER).tar.gz
tar xvfz $<
mv yaml-cpp-release-$(YAML-CPP_VER) yaml-cpp
yaml-cpp-$(YAML-CPP_VER).tar.gz:
wget -O $@ https://github.com/jbeder/yaml-cpp/archive/release-$(YAML-CPP_VER).tar.gz