Debian Codegraph @

Makefile

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #ARCH = MACOSX
2 ARCH = LINUX
3 #ARCH = MINGW32
4
5 PREFIX ?= /usr/local
6
7 ifeq "$(ARCH)" "MINGW32"
8 include makeinclude.mingw32
9 ARCH_OK = yes
10 endif
11
12 ifeq "$(ARCH)" "LINUX"
13 include makeinclude.linux
14 ARCH_OK = yes
15 endif
16
17 ifeq "$(ARCH)" "MACOSX"
18 include makeinclude.macosx
19 ARCH_OK = yes
20 endif
21
22 ifeq "$(ARCH_OK)" "yes"
23 #
24 # The given ARCH is correct
25 #
26
27 #
28 # Variables
29 #
30
31 CXXFLAGS = -g $(ARCHCXXFLAGS) -DENABLE_SOUND
32 LDFLAGS = -O2 $(ARCHLDFLAGS)
33
34 #
35 # List of all source files.
36 #
37 # Architecture-dependend files as defined in the makeinclude files are added
38 # automatically.
39 #
40 SOURCES = \
41 src/Loader.cxx \
42 src/Screen.cxx \
43 src/Texture.cxx \
44 src/main.cxx \
45 $(ARCHSOURCES)
46
47 #
48 # The objects are named like the source files, but instead of in directory
49 # src/, they are placed in directory obj/, and the architecture gets added
50 # to the name, e.g. obj/main.LINUX.o
51 #
52 OBJECTS=$(addsuffix .$(ARCH).o,$(basename $(subst src/,obj/,$(SOURCES))))
53
54 #
55 # The dependency files are named like the source files, but instead of in
56 # directory src/, they are placed in directory obj/, and the architecture
57 # gets added to the name, e.g. dep/main.LINUX.d
58 #
59 DEPENDS=$(addsuffix .$(ARCH).d,$(basename $(subst src/,dep/,$(SOURCES))))
60
61 #
62 # We need to create the directories for object and dependency files
63 # automatically. The following variables are lists of dummy files,
64 # one for each directory, and are used to in the rule to create the
65 # directories.
66 #
67 OBJECTDIRS=$(addsuffix .dir,$(sort $(dir $(OBJECTS))))
68 DEPENDDIRS=$(addsuffix .dir,$(sort $(dir $(DEPENDS))))
69
70 #
71 # Targets / Rules
72 #
73
74 #
75 # First target, depends on the target that builds the application
76 #
77 all: $(APP) README
78
79 #
80 # Targets / rules to make sure the directories for the object and
81 # dependency files exist.
82 #
83 .PRECIOUS: $(OBJECTDIRS) $(DEPENDDIRS)
84
85 %.dir:
86 @mkdir $(dir $@)
87 @touch $@
88
89 #
90 # Include the dependencies, but only if we are not doing a
91 # make clean or make depend
92 #
93 ifneq "$(MAKECMDGOALS)" "clean"
94 ifneq "$(MAKECMDGOALS)" "depend"
95 ifneq "$(MAKECMDGOALS)" ".depend"
96 -include $(DEPENDS)
97 endif
98 endif
99 endif
100
101 #
102 # Rule to build the application executable
103 #
104 $(APP): $(OBJECTS) $(ARCHAPPREQ)
105 $(CXX) $(OBJECTS) $(CXXFLAGS) $(LDFLAGS) -o $@
106
107 #
108 # MacOSX applications go into a bundle. The rule creates
109 # the bundle directory structure and populates it
110 #
111 macosx_app: Info.plist
112 mkdir -p jigzo.app/Contents/MacOS/
113 mkdir -p jigzo.app/Contents/Resources/
114 cp Info.plist jigzo.app/Contents/
115
116 #
117 # Compilation rules
118 #
119 obj/%.$(ARCH).o: src/%.c $(OBJECTDIRS)
120 @echo Compiling $<
121 $(CC) $(CXXFLAGS) -Wall -Weffc++ -c $< -o $@
122
123 obj/%.$(ARCH).o: src/%.cxx $(OBJECTDIRS)
124 @echo Compiling $<
125 $(CXX) $(CXXFLAGS) -Wall -c $< -o $@
126
127 obj/%.$(ARCH).o: src/%.cpp $(OBJECTDIRS)
128 @echo Compiling $<
129 $(CXX) $(CXXFLAGS) -Wall -c $< -o $@
130
131 #
132 # Dependency rules
133 #
134 dep/%.$(ARCH).d: src/%.c $(DEPENDDIRS)
135 @echo Generating dependency information for $<
136 $(CXX) -MM -MT $@ $(CXXFLAGS) $< -o [email protected]
137 @(cat [email protected] ; cat [email protected] | sed s/^dep/obj/ | sed s/\.d:/.o:/ ) > $@
138 @rm [email protected]
139
140 dep/%.$(ARCH).d: src/%.cxx $(DEPENDDIRS)
141 @echo Generating dependency information for $<
142 $(CXX) -MM -MT $@ $(CXXFLAGS) $< -o [email protected]
143 @(cat [email protected] ; cat [email protected] | sed s/^dep/obj/ | sed s/\.d:/.o:/ ) > $@
144 @rm [email protected]
145
146 dep/%.$(ARCH).d: src/%.cpp $(DEPENDDIRS)
147 @echo Generating dependency information for $<
148 $(CXX) -MM -MT $@ $(CXXFLAGS) $< -o [email protected]
149 @(cat [email protected] ; cat [email protected] | sed s/^dep/obj/ | sed s/\.d:/.o:/ ) > $@
150 @rm [email protected]
151
152 #
153 # Rules to force a rebuild of all dependency information
154 #
155 depend:
156 @rm -f $(DEPENDS)
157 @make ARCH=$(ARCH) .depend
158
159 .depend: $(DEPENDS)
160
161 #
162 # Rule to clean all generated files (objects, dependencies, executable)
163 #
164 clean:
165 rm -rf obj/ dep/ $(APP)
166
167 ifeq "$(ARCH)" "LINUX"
168
169 install: jigzo
170 @echo Installing in $(PREFIX)
171 rm -rf "$(PREFIX)/lib/jigzo/"
172 mkdir -p "$(PREFIX)/lib/jigzo/"
173 cp -r font image sound puzzles "$(PREFIX)/lib/jigzo/"
174 cp jigzo $(PREFIX)/lib/jigzo/jigzo.bin
175 echo -e '#!/bin/sh\n$(PREFIX)/lib/jigzo/jigzo.bin $$*\n' > $(PREFIX)/bin/jigzo
176 chmod +x $(PREFIX)/bin/$(APP)
177
178 endif
179
180 #
181 # Rules end here
182 #
183 else
184 #
185 # The given ARCH is incorrect or missing
186 #
187
188 all: .DEFAULT
189
190 clean:
191 rm -rf obj/ dep/ $(APP)
192
193 .DEFAULT:
194 ifeq "$(ARCH)" ""
195 @echo '#################################################################'
196 @echo 'ARCH not defined. Use make ARCH=[ LINUX | MACOSX | MINGW32 ]'
197 @echo 'or set the environment variable'
198 @echo '#################################################################'
199 else
200 @echo '#################################################################'
201 @echo 'ARCH $(ARCH) invalid. Use make ARCH=[ LINUX | MACOSX | MINGW32 ]'
202 @echo 'or set the environment variable'
203 @echo '#################################################################'
204 endif
205
206 endif
207
208 README: index.html
209 lynx -dump index.html | sed 's/^ *//' | sed 's/^ \([^ ]\)/ \1/g' | sed 's/\[[0123456789]\]//' | grep -v References | grep -v '^ *.\. ....://' > README
210
211
212 ###### DISTRIBUTABLE_UNTIL_HERE ######