Makefile.static 13.2 KB
Newer Older
1 2 3 4 5 6 7 8 9

##############################################################################

# If you have a suggestion for a name, tell me about it:
# <[email protected]>

# No quotes for these four:
# NAME = [technical] name
# NAME_C = Capitalized name (human name)
Oskar Skog's avatar
Oskar Skog committed
10
# DESCRIPTION =
11 12 13 14
# VERSION = x.y.z
NAME := anonymine
NAME_C := Anonymine
DESCRIPTION = Minesweeper without guessing
15
VERSION := 0.2.13
16

Oskar Skog's avatar
Oskar Skog committed
17 18
# Five more variables are required: sysconfdir, vargamesdir, EXECUTABLES and
# MODULES, and MODULES_OTHERVER which may be set to "non-existent".
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
# They will be prepended to the actual Makefile by the "configure" script.

# srcdir, builddir and DESTDIR may also be prepended by the "configure"
# script.

# freedesktop == "" if not freedesktop.org DE.
# windows == "" if not on Windows.
# macosx == "" if not on Mac OS X.

# See "INSTALL".

# Define these to prevent bugs on certain platforms.
PRE_INSTALL = true
NORMAL_INSTALL = true
POST_INSTALL = true
PRE_UNINSTALL = true
NORMAL_UNINSTALL = true
POST_UNINSTALL = true

##############################################################################

Oskar Skog's avatar
Oskar Skog committed
40 41 42
verbose ?= true
info := test "$(verbose)" != true || echo '//'

43 44 45 46 47 48
# Desktop specific prefixes:
# FD_	freedesktop.org
# OSX_	Mac OS X
# CYG_	Cygwin
# W_	Cygwin, "temporary" variables

Oskar Skog's avatar
Oskar Skog committed
49 50 51 52
MAIN_SRC := $(srcdir)$(NAME).py
MAIN_STAGE := $(builddir)$(NAME)
MAIN_DEST := $(DESTDIR)$(EXECUTABLES)/$(NAME)

Oskar Skog's avatar
Oskar Skog committed
53
HISCORE_FILE := $(DESTDIR)$(vargamesdir)/anonymine
Oskar Skog's avatar
Oskar Skog committed
54
ENGINECFG_STAGE := $(builddir)enginecfg.out
55 56

# freedesktop.org, see desktop/README
Oskar Skog's avatar
Oskar Skog committed
57 58 59
FD_MK_DESKTOP := $(srcdir)desktop/desktop.sh
FD_DESKTOP_STAGE := $(builddir)$(NAME).desktop
FD_DESKTOP_DEST := $(DESTDIR)$(prefix)/share/applications/$(NAME).desktop
60 61

# Mac OS X, see desktop/README
Oskar Skog's avatar
Oskar Skog committed
62 63 64 65 66
OSX_WRAPPER := $(builddir)$(NAME)-wrapper
OSX_INFO_PLIST := $(builddir)Info.plist
OSX_MK_INFO_PLIST := $(srcdir)desktop/Info.plist.py
OSX_ICON := $(builddir)icon.icns
OSX_MK_ICON := $(srcdir)desktop/icon.icns.py
67 68

# Windows/Cygwin, see desktop/README
Oskar Skog's avatar
Oskar Skog committed
69 70
CYG_ICO_SRC := $(srcdir)desktop/$(NAME).ico
CYG_ICO_DIR := $(DESTDIR)$(prefix)/share/pixmaps
71
CYG_ICO_DEST := $(CYG_ICO_DIR)/$(NAME).ico
72 73

# make clean
Oskar Skog's avatar
Oskar Skog committed
74
ALL_STAGE := "$(MAIN_STAGE)" "$(OSX_WRAPPER)" "$(OSX_INFO_PLIST)" \
Oskar Skog's avatar
Oskar Skog committed
75 76 77
	"$(OSX_ICON)" "$(builddir)check.py" "$(FD_DESKTOP_STAGE)" \
	"$(ENGINECFG_STAGE)" "$(builddir)mkenginecfg.py"

Oskar Skog's avatar
Oskar Skog committed
78 79
all : $(MAIN_STAGE) $(ENGINECFG_STAGE)
	@$(info) 'Maybe building .desktop and app/bundle'
80
	@if [ -n "$(freedesktop)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
81
		cd "$(builddir)" && make build-freedesktop > /dev/null; \
82 83
	fi
	@if [ -n "$(macosx)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
84
		cd "$(builddir)" && make build-macosx > /dev/null; \
85 86
	fi

Oskar Skog's avatar
Oskar Skog committed
87 88 89 90 91
$(MAIN_STAGE) : $(MAIN_SRC)
	@$(info) 'Creating the appropriate shebang line'
	@echo "#!`which python`" > "$(MAIN_STAGE)"
	@cat "$(MAIN_SRC)" >> "$(MAIN_STAGE)"

92
$(ENGINECFG_STAGE) : $(srcdir)mkenginecfg
Oskar Skog's avatar
Oskar Skog committed
93 94
	@$(info) 'Making enginecfg: mostly counting processors'
	@"$(srcdir)mkenginecfg" "$(srcdir)" "$(builddir)" "$(HISCORE_FILE)"
Oskar Skog's avatar
Oskar Skog committed
95 96 97 98 99 100 101 102 103 104 105 106 107 108

build-freedesktop : FORCE
	@: # Refer to desktop/README for information about the following.
	@"$(FD_MK_DESKTOP)" "$(FD_DESKTOP_STAGE)" $(NAME) "$(NAME_C)" \
		"$(DESCRIPTION) -- version $(VERSION)"

build-macosx : FORCE
	@: # Refer to desktop/README for information about the following.
	@echo '#!/bin/sh' > "$(OSX_WRAPPER)"
	@echo 'open -b com.apple.terminal' "$(MAIN_DEST)" >> "$(OSX_WRAPPER)"
	@python "$(OSX_MK_INFO_PLIST)" "$(OSX_INFO_PLIST)" "$(NAME_C)" \
		"$(NAME_C) - $(DESCRIPTION)" $(VERSION) $(NAME)
	@python "$(OSX_MK_ICON)" "$(OSX_ICON)" "$(srcdir)desktop/$(NAME)"

109 110 111
clean : FORCE
	@rm $(ALL_STAGE) 2> /dev/null || true
	@: # Remove the bytecode files.
Oskar Skog's avatar
Oskar Skog committed
112 113
	@rm -- "$(srcdir)"*.pyc 2> /dev/null || true
	@rm -r -- "$(srcdir)"__pycache__/ 2> /dev/null || true
114 115

# configure.py will choose /usr/ucb/install on Solares.
116
INSTALL ?= install
117

Oskar Skog's avatar
Oskar Skog committed
118 119
INSTALL_CFG := python "$(srcdir)install-cfg" "$(INSTALL)"

Oskar Skog's avatar
Oskar Skog committed
120
CFG_DIR := $(DESTDIR)$(sysconfdir)/$(NAME)
121
# Modules: FOO_SRC, FOO_DEST, FOO_DEST_OTHERVER
Oskar Skog's avatar
Oskar Skog committed
122 123 124 125 126 127 128 129 130
ENGINE_SRC := $(srcdir)$(NAME)_engine.py
ENGINE_DEST := $(DESTDIR)$(MODULES)/$(NAME)_engine.py
ENGINE_DEST_OTHERVER := $(DESTDIR)$(MODULES_OTHERVER)/$(NAME)_engine.py
SOLVER_SRC := $(srcdir)$(NAME)_solver.py
SOLVER_DEST := $(DESTDIR)$(MODULES)/$(NAME)_solver.py
SOLVER_DEST_OTHERVER := $(DESTDIR)$(MODULES_OTHERVER)/$(NAME)_solver.py
FIELDS_SRC := $(srcdir)$(NAME)_fields.py
FIELDS_DEST := $(DESTDIR)$(MODULES)/$(NAME)_fields.py
FIELDS_DEST_OTHERVER := $(DESTDIR)$(MODULES_OTHERVER)/$(NAME)_fields.py
131 132 133 134 135

# Installation commands for modules:
NO_OTHERVER := test "$(MODULES_OTHERVER)" "=" non-existent

# See desktop/README
Oskar Skog's avatar
Oskar Skog committed
136 137
FD_ICON_SRC := $(srcdir)desktop/$(NAME)-$$size.png
FD_ICON_DESTDIR := $(DESTDIR)$(prefix)/share/icons/hicolor/$$size/apps
138 139
FD_ICON_SIZES := 16x16 32x32 64x64 256x256
FD_ICON_DEST := $(FD_ICON_DESTDIR)/$(NAME).png
140 141

# See desktop/README
Oskar Skog's avatar
Oskar Skog committed
142 143
BUNDLE := $(DESTDIR)/Applications/$(NAME_C).app

144 145 146 147

check-install-cfg : FORCE
	@$(PRE_INSTALL)
	@: # Cause installation to fail if the configuration is incompatible.
Oskar Skog's avatar
Oskar Skog committed
148
	@$(info) 'Installing or checking configuration'
Oskar Skog's avatar
Oskar Skog committed
149
	@: #$(INSTALL) -d "$(CFG_DIR)"
Oskar Skog's avatar
Oskar Skog committed
150 151
	@$(INSTALL_CFG) "$(srcdir)cursescfg" "$(CFG_DIR)/cursescfg"
	@$(INSTALL_CFG) "$(ENGINECFG_STAGE)" "$(CFG_DIR)/enginecfg"
152 153

overwrite-cfg: FORCE
Oskar Skog's avatar
Oskar Skog committed
154 155
	@$(INSTALL) -m 644 "$(srcdir)cursescfg" "$(CFG_DIR)/cursescfg"
	@$(INSTALL) -m 644 "$(ENGINECFG_STAGE)" "$(CFG_DIR)/enginecfg"
156 157
	@$(info) "Configuration has been overwritten"
	@$(info) "All (if any) system-wide modifications are lost"
158 159

install-dirs : FORCE
Oskar Skog's avatar
Oskar Skog committed
160
	@$(info) 'Installing directories'
Oskar Skog's avatar
Oskar Skog committed
161 162
	@mkdir -p "$(CFG_DIR)" || true
	@mkdir -p "$(DESTDIR)$(vargamesdir)" || true
Oskar Skog's avatar
Oskar Skog committed
163 164
	@mkdir -p "$(DESTDIR)$(EXECUTABLES)" || true
	@mkdir -p "$(DESTDIR)$(MODULES)" || true
165
	@if [ "$(MODULES_OTHERVER)" != "non-existent" ]; then \
Oskar Skog's avatar
Oskar Skog committed
166
		mkdir -p "$(DESTDIR)$(MODULES_OTHERVER)" || true; \
167 168
	fi
	@if [ -n "$(freedesktop)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
169 170 171 172 173 174 175
		mkdir -p "$(DESTDIR)$(prefix)/share/applications" || true; \
		mkdir -p "$(DESTDIR)$(prefix)/share/pixmaps" || true; \
	fi
	@if [ -n "$(macosx)" ]; then \
		$(INSTALL) -d "$(BUNDLE)/Contents"; \
		$(INSTALL) -d "$(BUNDLE)/Contents/MacOS"; \
		$(INSTALL) -d "$(BUNDLE)/Contents/Resources"; \
176 177 178 179 180 181
	fi

install : check-install-cfg install-dirs
	@$(NORMAL_INSTALL)
	@: # When the configuration has been installed, install the main
	@: # program, and then the modules for both versions of Python.
Oskar Skog's avatar
Oskar Skog committed
182 183 184 185 186
	@$(info) 'Installing executable and modules'
	@$(INSTALL) -m 755 "$(MAIN_STAGE)" "$(MAIN_DEST)"
	@$(INSTALL) -m 644 "$(ENGINE_SRC)" "$(ENGINE_DEST)"
	@$(INSTALL) -m 644 "$(SOLVER_SRC)" "$(SOLVER_DEST)"
	@$(INSTALL) -m 644 "$(FIELDS_SRC)" "$(FIELDS_DEST)"
Oskar Skog's avatar
Oskar Skog committed
187 188 189
	@: # Create highscore file unless it already exists.
	@touch "$(HISCORE_FILE)"
	@chmod 666 "$(HISCORE_FILE)"
190
	@if [ -n "$(freedesktop)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
191 192
		$(info) 'Installing icons and .desktop (NORMAL_INSTALL)'; \
		$(INSTALL) -m 644 "$(FD_DESKTOP_STAGE)" "$(FD_DESKTOP_DEST)"; \
193
		for size in $(FD_ICON_SIZES); do \
Oskar Skog's avatar
Oskar Skog committed
194 195
			$(INSTALL) -d "$(FD_ICON_DESTDIR)"; \
			$(INSTALL) -m 644 "$(FD_ICON_SRC)" "$(FD_ICON_DEST)"; \
196 197 198
		done; \
	fi
	@if [ -n "$(macosx)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
199 200 201 202 203 204 205
		$(info) 'Installing app/bundle'; \
		$(INSTALL) -m 644 "$(OSX_INFO_PLIST)" \
			"$(BUNDLE)/Contents/Info.plist"; \
		$(INSTALL) -m 755 "$(OSX_WRAPPER)" \
			"$(BUNDLE)/Contents/MacOS/$(NAME)-wrapper"; \
		$(INSTALL) -m 644 "$(OSX_ICON)" \
			"$(BUNDLE)/Contents/Resources/icon.icns"; \
206
	fi
Oskar Skog's avatar
Oskar Skog committed
207 208 209 210
	@$(info) 'Symlinking the modules to the other Python'
	@$(NO_OTHERVER) || ln -sf "$(ENGINE_DEST)" "$(ENGINE_DEST_OTHERVER)"
	@$(NO_OTHERVER) || ln -sf "$(SOLVER_DEST)" "$(SOLVER_DEST_OTHERVER)"
	@$(NO_OTHERVER) || ln -sf "$(FIELDS_DEST)" "$(FIELDS_DEST_OTHERVER)"
211 212
	@$(POST_INSTALL)
	@if [ -n "$(freedesktop)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
213
		$(info) 'Installing icons and .desktop (POST_INSTALL)'; \
214
		xdg-desktop-menu install --novendor --mode system \
Oskar Skog's avatar
Oskar Skog committed
215
			"$(FD_DESKTOP_DEST)" || true; \
216 217
	fi
	@if [ -n "$(windows)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
218 219
		$(info) 'Installing shortcuts'; \
		$(INSTALL) "$(CYG_ICO_SRC)" "$(CYG_ICO_DEST)"; \
220
		mkshortcut -A -P -a '-lc $(NAME)' -n "$(NAME_C)" \
Oskar Skog's avatar
Oskar Skog committed
221
			-i "$(CYG_ICO_DEST)" /bin/bash.exe || \
222
			mkshortcut -P -a '-lc $(NAME)' -n "$(NAME_C)" \
Oskar Skog's avatar
Oskar Skog committed
223
			-i "$(CYG_ICO_DEST)" /bin/bash.exe; \
224
		mkshortcut -A -D -a '-lc $(NAME)' -n "$(NAME_C)" \
Oskar Skog's avatar
Oskar Skog committed
225
			-i "$(CYG_ICO_DEST)" /bin/bash.exe || \
226
			mkshortcut -D -a '-lc $(NAME)' -n "$(NAME_C)" \
Oskar Skog's avatar
Oskar Skog committed
227
			-i "$(CYG_ICO_DEST)" /bin/bash.exe; \
228 229 230
	fi

# http://superuser.com/questions/86078/where-do-start-menu-all-programs-shortcuts-reside
Oskar Skog's avatar
Oskar Skog committed
231 232 233 234
W_C := $(DESTDIR)/cygdrive/c
W_U := $(DESTDIR)`cygpath --unix '$(USERPROFILE)'`
W_F := $(NAME_C).lnk
W_M := /Start Menu/Programs/
235 236 237
# W_C is the C drive, W_U is the users real home directory,
# W_F is the filename and W_M is a part of the path to the start menu
# common for both NT 5 and 6.
Oskar Skog's avatar
Oskar Skog committed
238
CYG_STARTMENU_NT5X_ALL := $(W_C)/Documents and Settings/All Users$(W_M)$(W_F)
239
CYG_STARTMENU_NT5X_ME := $(W_U)$(W_M)$(W_F)
Oskar Skog's avatar
Oskar Skog committed
240 241 242
CYG_STARTMENU_NT6X_ALL := $(W_C)/ProgramData/Microsoft/Windows$(W_M)$(W_F)
CYG_STARTMENU_NT6X_ME := $(W_U)/AppData/Roaming/Microsoft/Windows$(W_M)$(W_F)
CYG_DESKTOP_NT5X_ALL := $(W_C)/Documents and Settings/All Users/Desktop$(W_F)
243 244
CYG_DESKTOP_NT6X_ALL := $(W_C)/Users/Public/Desktop/$(W_F)
CYG_DESKTOP_ME := $(W_U)/Desktop/$(W_F)
245 246 247 248 249

uninstall: FORCE
	@$(PRE_UNINSTALL)
	@if [ -n "$(freedesktop)" ]; then \
		xdg-desktop-menu uninstall --novendor --mode system \
Oskar Skog's avatar
Oskar Skog committed
250
			"$(FD_DESKTOP_DEST)" || true; \
251 252
	fi
	@$(NORMAL_UNINSTALL)
Oskar Skog's avatar
Oskar Skog committed
253 254 255 256
	@-rm -r "$(CFG_DIR)"
	@-rm "$(ENGINE_DEST)" "$(SOLVER_DEST)" "$(FIELDS_DEST)" "$(MAIN_DEST)"
	@$(NO_OTHERVER) || rm "$(ENGINE_DEST_OTHERVER)" \
		"$(SOLVER_DEST_OTHERVER)" "$(FIELDS_DEST_OTHERVER)" || true
257
	@if [ -n "$(freedesktop)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
258
		rm "$(FD_DESKTOP_DEST)" || true; \
259
		for size in $(FD_ICON_SIZES); do \
Oskar Skog's avatar
Oskar Skog committed
260
			rm "$(FD_ICON_DEST)" || true; \
261 262 263
		done; \
	fi
	@if [ -n "$(macosx)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
264
		rm -r "$(BUNDLE)" || true; \
265 266
	fi
	@if [ -n "$(windows)" ]; then \
Oskar Skog's avatar
Oskar Skog committed
267 268 269 270 271 272 273
		rm "$(CYG_STARTMENU_NT5X_ALL)" || true; \
		rm "$(CYG_STARTMENU_NT5X_ME)" || true; \
		rm "$(CYG_STARTMENU_NT6X_ALL)" || true; \
		rm "$(CYG_STARTMENU_NT6X_ME)" || true; \
		rm "$(CYG_DESKTOP_NT5X_ALL)" || true; \
		rm "$(CYG_DESKTOP_NT6X_ALL)" || true; \
		rm "$(CYG_DESKTOP_ME)" || true; \
274 275 276 277 278 279 280 281 282 283 284 285 286
	fi

print-destinations: FORCE
	@echo "> Main program:\t\t\t" $(MAIN_DEST)
	@echo "> Engine module:\t\t" $(ENGINE_DEST)
	@echo "> Solver module:\t\t" $(SOLVER_DEST)
	@echo "> Fields module:\t\t" $(FIELDS_DEST)
	@$(NO_OTHERVER) || \
		echo "> Engine module symlink:\t" $(ENGINE_DEST_OTHERVER)
	@$(NO_OTHERVER) || \
		echo "> Solver module symlink:\t" $(SOLVER_DEST_OTHERVER)
	@$(NO_OTHERVER) || \
		echo "> Fields module symlink:\t" $(FIELDS_DEST_OTHERVER)
287 288
	@echo "> Configuration files:\t\t" $(CFG_DIR) '(directory)'
	@echo "> Highscores file:\t\t" $(HISCORE_FILE)
289
	@if [ -n "$(freedesktop)" ]; then \
290 291 292
		echo "> [freedesktop.org] .desktop:\t" $(FD_DESKTOP_DEST); \
		for size in $(FD_ICON_SIZES); do \
			echo "> [freedesktop.org] Icon:\t" $(FD_ICON_DEST); \
293 294 295
		done; \
	fi
	@if [ -n "$(macosx)" ]; then \
296
		echo "> [Mac OS X] Bundle (App):\t" $(BUNDLE) '(directory)'; \
297 298
	fi
	@if [ -n "$(windows)" ]; then \
299 300 301 302 303 304 305 306
		echo "> [Windows] Shortcut:\t\t" $(CYG_STARTMENU_NT5X_ALL); \
		echo "> [Windows] Shortcut:\t\t" $(CYG_STARTMENU_NT5X_ME); \
		echo "> [Windows] Shortcut:\t\t" $(CYG_STARTMENU_NT6X_ALL); \
		echo "> [Windows] Shortcut:\t\t" $(CYG_STARTMENU_NT6X_ME); \
		echo "> [Windows] Shortcut:\t\t" $(CYG_DESKTOP_NT5X_ALL); \
		echo "> [Windows] Shortcut:\t\t" $(CYG_DESKTOP_NT6X_ALL); \
		echo "> [Windows] Shortcut:\t\t" $(CYG_DESKTOP_ME); \
		echo "> [Windows] Icon:\t\t" $(CYG_ICO_DEST); \
307 308 309
	fi

PKG_INDIR := $(NAME)-$(VERSION)
Oskar Skog's avatar
Oskar Skog committed
310
PKG := $(builddir)$(PKG_INDIR)
311
# .txt in zips.
312 313
PKG_TEXTFILES := BUGS ChangeLog FAQ INSTALL NEWS README desktop/FILES \
	desktop/README LICENSE
314 315
# Already CRLF + old crap.
PKG_NOCONV := Windows.txt Windows-admin.bat Windows-user.bat \
Oskar Skog's avatar
Oskar Skog committed
316 317
	configure check.sh desktop/$(NAME).ico desktop/desktop.sh \
	desktop/$(NAME)-*.png desktop/$(NAME)*.xcf mkenginecfg
318
PKG_FILES := $(NAME).py $(NAME)_engine.py $(NAME)_fields.py $(NAME)_solver.py \
Oskar Skog's avatar
Oskar Skog committed
319 320
	configure.py Makefile.static install-cfg enginecfg.default \
	cursescfg test.py desktop/Info.plist.py desktop/icon.icns.py
Oskar Skog's avatar
Oskar Skog committed
321
PKG_SUBDIRS := desktop
322 323 324 325 326

check: FORCE
	@$(srcdir)check.sh "$(srcdir)" "$(builddir)"

dist : tarballs zip
Oskar Skog's avatar
Oskar Skog committed
327
	@$(info) 'make check; This will take a while'
328
	@make check >/dev/null
Oskar Skog's avatar
Oskar Skog committed
329
	@$(info) 'make release'
330 331 332
	@make release >/dev/null

release : FORCE
Oskar Skog's avatar
Oskar Skog committed
333
	@cp -t ~www-data/archive/"$(NAME)/" "$(PKG).tar.gz" \
334
		|| echo You are not me.
Oskar Skog's avatar
Oskar Skog committed
335
	@cp -t ~www-data/archive/"$(NAME)/" "$(PKG).zip" \
336 337 338
		|| echo You are not me.

tarballs : FORCE
339
	@$(info) "Building tarballs"
Oskar Skog's avatar
Oskar Skog committed
340 341
	@mkdir "$(PKG)"
	@for subdir in $(PKG_SUBDIRS); do mkdir "$(PKG)/$$subdir"; done;
342
	@: # Copy all files normally:
Oskar Skog's avatar
Oskar Skog committed
343 344 345
	@for f in $(PKG_TEXTFILES); do cp "$(srcdir)$$f" "$(PKG)/$$f"; done
	@for f in $(PKG_NOCONV); do cp "$(srcdir)$$f" "$(PKG)/$$f"; done
	@for f in $(PKG_FILES); do cp "$(srcdir)$$f" "$(PKG)/$$f"; done
346
	@: # Tar:
Oskar Skog's avatar
Oskar Skog committed
347
	@cd "$(builddir)" && tar -cf "$(PKG_INDIR).tar" "$(PKG_INDIR)"
348
	@: # Compress:
Oskar Skog's avatar
Oskar Skog committed
349
	@gzip -f9k -- "$(PKG).tar"
350
	@: # Clean-up:
Oskar Skog's avatar
Oskar Skog committed
351 352
	@rm -- "$(PKG).tar"
	@rm -r -- "$(PKG)"
353 354

zip : FORCE
355
	@$(info) "Building zip for Windows version"
Oskar Skog's avatar
Oskar Skog committed
356 357
	@mkdir "$(PKG)"
	@for subdir in $(PKG_SUBDIRS); do mkdir "$(PKG)/$$subdir"; done;
358 359
	@: # /(.*)$/ -> /\1.txt/
	@for f in $(PKG_TEXTFILES); do \
Oskar Skog's avatar
Oskar Skog committed
360
		unix2dos -q -n "$(srcdir)$$f" "$(PKG)/$$f.txt"; \
361
	done
Oskar Skog's avatar
Oskar Skog committed
362 363
	@: # Already with CRLF line ends + shell scripts.
	@for f in $(PKG_NOCONV); do cp "$(srcdir)$$f" "$(PKG)/$$f"; done
364
	@: # Notepad is stupid.
Oskar Skog's avatar
Oskar Skog committed
365 366 367 368 369
	@for f in $(PKG_FILES); \
		do unix2dos -q -n "$(srcdir)$$f" "$(PKG)/$$f"; \
	done
	@cd "$(builddir)" && zip -rXq "$(PKG_INDIR).zip" "$(PKG_INDIR)"
	@rm -r -- "$(PKG)"
370 371 372


FORCE: