| 1 |
# Author: Erwin Waterlander |
| 2 |
# |
| 3 |
# Copyright (C) 2009-2025 Erwin Waterlander |
| 4 |
# All rights reserved. |
| 5 |
# |
| 6 |
# Redistribution and use in source and binary forms, with or without |
| 7 |
# modification, are permitted provided that the following conditions |
| 8 |
# are met: |
| 9 |
# 1. Redistributions of source code must retain the above copyright |
| 10 |
# notice, this list of conditions and the following disclaimer. |
| 11 |
# 2. Redistributions in binary form must reproduce the above copyright |
| 12 |
# notice in the documentation and/or other materials provided with |
| 13 |
# the distribution. |
| 14 |
# |
| 15 |
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY |
| 16 |
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18 |
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE |
| 19 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 |
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
| 21 |
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 22 |
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 23 |
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 24 |
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 25 |
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 |
# |
| 27 |
# Description |
| 28 |
# |
| 29 |
# This is a GNU Makefile that uses GNU compilers, linkers and cpp. The |
| 30 |
# platform specific issues are determined by the various OS teets that |
| 31 |
# rely on the uname(1) command and directory locations. |
| 32 |
# |
| 33 |
# Set additional flags for the build with variables CFLAGS_USER, |
| 34 |
# DEFS_USER and LDFLAGS_USER. |
| 35 |
|
| 36 |
include version.mk |
| 37 |
|
| 38 |
.PHONY: doc man txt html pdf mofiles tags merge test check |
| 39 |
|
| 40 |
.PRECIOUS: %.1 %.pod |
| 41 |
|
| 42 |
CC ?= gcc |
| 43 |
CPP ?= cpp |
| 44 |
CPP_FLAGS_POD = ALL |
| 45 |
STRIP = strip |
| 46 |
|
| 47 |
PACKAGE = dos2unix |
| 48 |
UNIX2DOS = unix2dos |
| 49 |
MAC2UNIX = mac2unix |
| 50 |
UNIX2MAC = unix2mac |
| 51 |
|
| 52 |
# Native Language Support (NLS) |
| 53 |
ENABLE_NLS = 1 |
| 54 |
# Large File Support (LFS) |
| 55 |
LFS = 1 |
| 56 |
# DEBUG=1 adds the -g option to CFLAGS, for adding debug symbols. |
| 57 |
DEBUG = 0 |
| 58 |
# DEBUGMSG=1 adds -DDEBUG=1 to CFLAGS, for extra verbose messages. |
| 59 |
DEBUGMSG = 0 |
| 60 |
UCS = 1 |
| 61 |
DIST_TARGET = dist-tgz |
| 62 |
|
| 63 |
EXE= |
| 64 |
|
| 65 |
BIN = $(PACKAGE)$(EXE) |
| 66 |
UNIX2DOS_BIN = $(UNIX2DOS)$(EXE) |
| 67 |
MAC2UNIX_BIN = $(MAC2UNIX)$(EXE) |
| 68 |
UNIX2MAC_BIN = $(UNIX2MAC)$(EXE) |
| 69 |
|
| 70 |
LINK = ln -sf |
| 71 |
LINK_MAN = $(LINK) |
| 72 |
|
| 73 |
prefix = /usr |
| 74 |
exec_prefix = $(prefix) |
| 75 |
bindir = $(exec_prefix)/bin |
| 76 |
datarootdir = $(prefix)/share |
| 77 |
datadir = $(datarootdir) |
| 78 |
|
| 79 |
docsubdir = $(PACKAGE)-$(DOS2UNIX_VERSION) |
| 80 |
docdir = $(datarootdir)/doc/$(docsubdir) |
| 81 |
localedir = $(datarootdir)/locale |
| 82 |
mandir = $(datarootdir)/man |
| 83 |
man1dir = $(mandir)/man1 |
| 84 |
manext = .1 |
| 85 |
man1ext = .1 |
| 86 |
|
| 87 |
ifdef ENABLE_NLS |
| 88 |
POT = po/$(PACKAGE).pot |
| 89 |
POFILES = $(wildcard po/*.po) |
| 90 |
MOFILES = $(patsubst %.po,%.mo,$(POFILES)) |
| 91 |
NLSSUFFIX = -nls |
| 92 |
endif |
| 93 |
|
| 94 |
HTMLEXT = htm |
| 95 |
# English only documents. |
| 96 |
INSTALL_OBJS_DOC = README.txt INSTALL.txt NEWS.txt ChangeLog.txt COPYING.txt TODO.txt BUGS.txt |
| 97 |
|
| 98 |
# English manual |
| 99 |
MANFILES_EN = man/man1/$(PACKAGE).1 |
| 100 |
TXTFILES_EN = man/man1/$(PACKAGE).txt |
| 101 |
HTMLFILES_EN = man/man1/$(PACKAGE).$(HTMLEXT) |
| 102 |
PSFILES_EN = man/man1/$(PACKAGE).ps |
| 103 |
PDFFILES_EN = man/man1/$(PACKAGE).pdf |
| 104 |
|
| 105 |
# International manuals |
| 106 |
ifdef ENABLE_NLS |
| 107 |
MANPOTFILE = po-man/dos2unix-man.pot |
| 108 |
MANPOFILES = $(wildcard po-man/*.po) |
| 109 |
MANPODFILES = $(patsubst po-man/%.po,man/%/man1/dos2unix.pod,$(MANPOFILES)) |
| 110 |
endif |
| 111 |
MANFILES = $(patsubst %.pod,%.1,$(MANPODFILES)) |
| 112 |
TXTFILES = $(patsubst %.pod,%.txt,$(MANPODFILES)) |
| 113 |
HTMLFILES = $(patsubst %.pod,%.$(HTMLEXT),$(MANPODFILES)) |
| 114 |
PSFILES = $(patsubst %.pod,%.ps,$(MANPODFILES)) |
| 115 |
PDFFILES = $(patsubst %.pod,%.pdf,$(MANPODFILES)) |
| 116 |
|
| 117 |
# On some systems (e.g. FreeBSD 4.10) GNU install is installed as `ginstall'. |
| 118 |
INSTALL = install |
| 119 |
INSTALL_PROGRAM = $(INSTALL) -m 755 |
| 120 |
INSTALL_DATA = $(INSTALL) -m 644 |
| 121 |
|
| 122 |
# On some systems (e.g. GNU Win32) GNU mkdir is installed as `gmkdir'. |
| 123 |
MKDIR = mkdir |
| 124 |
|
| 125 |
ifdef ENABLE_NLS |
| 126 |
DOS2UNIX_NLSDEFS = -DENABLE_NLS -DLOCALEDIR=\"$(localedir)\" -DPACKAGE=\"$(PACKAGE)\" |
| 127 |
endif |
| 128 |
|
| 129 |
VERSIONSUFFIX = -bin |
| 130 |
|
| 131 |
# ......................................................... OS flags ... |
| 132 |
|
| 133 |
|
| 134 |
ifndef D2U_OS |
| 135 |
d2u_os=$(shell uname -s) |
| 136 |
|
| 137 |
ifeq ($(findstring CYGWIN,$(d2u_os)),CYGWIN) |
| 138 |
D2U_OS = cygwin |
| 139 |
endif |
| 140 |
|
| 141 |
ifndef D2U_OS |
| 142 |
ifeq ($(findstring MSYS,$(d2u_os)),MSYS) |
| 143 |
D2U_OS = msys |
| 144 |
endif |
| 145 |
endif |
| 146 |
|
| 147 |
ifndef D2U_OS |
| 148 |
ifeq ($(findstring MINGW32,$(d2u_os)),MINGW32) |
| 149 |
D2U_OS = mingw32 |
| 150 |
endif |
| 151 |
endif |
| 152 |
|
| 153 |
ifndef D2U_OS |
| 154 |
ifeq ($(findstring MINGW64,$(d2u_os)),MINGW64) |
| 155 |
D2U_OS = mingw64 |
| 156 |
endif |
| 157 |
endif |
| 158 |
|
| 159 |
ifndef D2U_OS |
| 160 |
ifneq ($(DJGPP),) |
| 161 |
D2U_OS = msdos |
| 162 |
endif |
| 163 |
endif |
| 164 |
|
| 165 |
ifndef D2U_OS |
| 166 |
ifneq (, $(wildcard /opt/csw)) |
| 167 |
D2U_OS = sun |
| 168 |
endif |
| 169 |
endif |
| 170 |
|
| 171 |
ifndef D2U_OS |
| 172 |
D2U_OS=$(shell echo $(d2u_os) | tr [A-Z] [a-z]) |
| 173 |
endif |
| 174 |
|
| 175 |
endif |
| 176 |
|
| 177 |
ifeq (cygwin,$(D2U_OS)) |
| 178 |
ifdef ENABLE_NLS |
| 179 |
LIBS_EXTRA = -lintl -liconv |
| 180 |
endif |
| 181 |
LDFLAGS_EXTRA = -Wl,--enable-auto-import |
| 182 |
EXE = .exe |
| 183 |
# allow non-cygwin clients which do not understand cygwin |
| 184 |
# symbolic links to launch applications... |
| 185 |
LINK = ln -f |
| 186 |
# but use symbolic links for man pages, since man client |
| 187 |
# IS a cygwin app and DOES understand symlinks. |
| 188 |
LINK_MAN = ln -fs |
| 189 |
# Cygwin packaging standard avoids version numbers on |
| 190 |
# documentation directories. |
| 191 |
docsubdir = $(PACKAGE) |
| 192 |
MACHINE := $(subst -pc-cygwin,,$(shell gcc -dumpmachine)) |
| 193 |
VERSIONSUFFIX = -cygwin-$(MACHINE) |
| 194 |
endif |
| 195 |
|
| 196 |
ifeq (msys,$(D2U_OS)) |
| 197 |
CC=gcc |
| 198 |
EXE = .exe |
| 199 |
MACHINE := $(subst -pc-msys,,$(shell gcc -dumpmachine)) |
| 200 |
# MSYS 1 does not support locales and no Unicode. |
| 201 |
ifeq ($(shell ./test/chk_loc.sh en_US.utf8),no) |
| 202 |
UCS = |
| 203 |
VERSIONSUFFIX = -msys1-$(MACHINE) |
| 204 |
else |
| 205 |
VERSIONSUFFIX = -msys2-$(MACHINE) |
| 206 |
endif |
| 207 |
ifdef ENABLE_NLS |
| 208 |
LIBS_EXTRA = -lintl -liconv |
| 209 |
endif |
| 210 |
endif |
| 211 |
|
| 212 |
ifeq (mingw32,$(D2U_OS)) |
| 213 |
CC=gcc |
| 214 |
prefix=c:/usr/local |
| 215 |
EXE = .exe |
| 216 |
VERSIONSUFFIX = -win32 |
| 217 |
LINK = cp -f |
| 218 |
UNIFILE=1 |
| 219 |
DIST_TARGET = dist-zip |
| 220 |
ifdef ENABLE_NLS |
| 221 |
LIBS_EXTRA = -lintl -liconv |
| 222 |
ZIPOBJ_EXTRA = bin/libintl-8.dll bin/libiconv-2.dll |
| 223 |
endif |
| 224 |
ifeq ($(findstring w64-mingw32,$(shell gcc -dumpmachine)),w64-mingw32) |
| 225 |
# Mingw-w64 |
| 226 |
CFLAGS_COMPILER = -DD2U_COMPILER=MINGW32_W64 |
| 227 |
ifdef ENABLE_NLS |
| 228 |
ZIPOBJ_EXTRA += bin/libgcc_s_dw2-1.dll bin/libwinpthread-1.dll |
| 229 |
endif |
| 230 |
CRT_GLOB_OBJ = /mingw32/lib/CRT_glob.o |
| 231 |
LIBS_EXTRA += $(CRT_GLOB_OBJ) |
| 232 |
CFLAGS_OS=-I/mingw32/include |
| 233 |
else |
| 234 |
CFLAGS_OS=-D_O_U16TEXT=0x20000 |
| 235 |
endif |
| 236 |
endif |
| 237 |
|
| 238 |
ifeq (mingw64,$(D2U_OS)) |
| 239 |
CC=gcc |
| 240 |
prefix=c:/usr/local64 |
| 241 |
EXE = .exe |
| 242 |
VERSIONSUFFIX = -win64 |
| 243 |
LINK = cp -f |
| 244 |
UNIFILE=1 |
| 245 |
DIST_TARGET = dist-zip |
| 246 |
ifdef ENABLE_NLS |
| 247 |
LIBS_EXTRA = -lintl -liconv |
| 248 |
ZIPOBJ_EXTRA = bin/libintl-8.dll bin/libiconv-2.dll |
| 249 |
endif |
| 250 |
CRT_GLOB_OBJ = /mingw64/lib/CRT_glob.o |
| 251 |
LIBS_EXTRA += $(CRT_GLOB_OBJ) |
| 252 |
CFLAGS_OS=-I/mingw64/include |
| 253 |
endif |
| 254 |
|
| 255 |
ifeq (msdos,$(D2U_OS)) |
| 256 |
prefix=c:/dos32 |
| 257 |
EXE = .exe |
| 258 |
VERSIONSUFFIX = pm |
| 259 |
LINK_MAN = cp -f |
| 260 |
docsubdir = dos2unix |
| 261 |
UCS = |
| 262 |
ZIPOBJ_EXTRA = bin/cwsdpmi.exe |
| 263 |
ifdef ENABLE_NLS |
| 264 |
LIBS_EXTRA = -lintl -liconv |
| 265 |
endif |
| 266 |
endif |
| 267 |
|
| 268 |
ifeq (os/2,$(D2U_OS)) |
| 269 |
prefix=c:/usr |
| 270 |
EXE = .exe |
| 271 |
VERSIONSUFFIX = -os2 |
| 272 |
LINK_MAN = cp -f |
| 273 |
UCS = |
| 274 |
LDFLAGS_EXTRA = -Zargs-wild |
| 275 |
DIST_TARGET = dist-zip |
| 276 |
ifdef ENABLE_NLS |
| 277 |
LIBS_EXTRA += -lintl -liconv |
| 278 |
endif |
| 279 |
endif |
| 280 |
|
| 281 |
ifeq (freemint,$(D2U_OS)) |
| 282 |
prefix=/usr |
| 283 |
EXE = |
| 284 |
VERSIONSUFFIX = -freemint |
| 285 |
UCS= |
| 286 |
ENABLE_NLS= |
| 287 |
ifdef ENABLE_NLS |
| 288 |
LIBS_EXTRA += -lintl -liconv |
| 289 |
endif |
| 290 |
EXTRA_DEFS += -Dfreemint -D__OS=\"freemint\" |
| 291 |
endif |
| 292 |
|
| 293 |
ifeq (freebsd,$(D2U_OS)) |
| 294 |
ifdef ENABLE_NLS |
| 295 |
CFLAGS_OS = -I/usr/local/include |
| 296 |
LDFLAGS_EXTRA = -L/usr/local/lib |
| 297 |
LIBS_EXTRA = -lintl |
| 298 |
endif |
| 299 |
endif |
| 300 |
|
| 301 |
ifeq (darwin,$(D2U_OS)) |
| 302 |
ifdef ENABLE_NLS |
| 303 |
CFLAGS_OS = -I/usr/local/include |
| 304 |
LDFLAGS_EXTRA = -L/usr/local/lib |
| 305 |
LIBS_EXTRA = -lintl |
| 306 |
endif |
| 307 |
endif |
| 308 |
|
| 309 |
ifeq (sun,$(D2U_OS)) |
| 310 |
# Running under SunOS/Solaris |
| 311 |
LIBS_EXTRA = -lintl |
| 312 |
endif |
| 313 |
|
| 314 |
ifeq (hp-ux,$(D2U_OS)) |
| 315 |
# Running under HP-UX |
| 316 |
EXTRA_DEFS += -Dhpux -D_HPUX_SOURCE |
| 317 |
endif |
| 318 |
|
| 319 |
|
| 320 |
# ............................................................ flags ... |
| 321 |
|
| 322 |
# PostScript and PDF generation from UTF-8 manuals is not working, |
| 323 |
# or I don't know how to do it. |
| 324 |
|
| 325 |
CFLAGS_USER = |
| 326 |
ifeq ($(DEBUG), 1) |
| 327 |
CFLAGS ?= -O0 |
| 328 |
else |
| 329 |
CFLAGS ?= -O2 |
| 330 |
endif |
| 331 |
CFLAGS += -Wall -Wextra -Wconversion $(RPM_OPT_FLAGS) $(CPPFLAGS) $(CFLAGS_USER) |
| 332 |
|
| 333 |
EXTRA_CFLAGS = -DVER_REVISION=\"$(DOS2UNIX_VERSION)\" \ |
| 334 |
-DVER_DATE=\"$(DOS2UNIX_DATE)\" \ |
| 335 |
-DVER_AUTHOR=\"$(DOS2UNIX_AUTHOR)\" \ |
| 336 |
-DDEBUG=$(DEBUGMSG) \ |
| 337 |
$(CFLAGS_OS) \ |
| 338 |
$(CFLAGS_COMPILER) |
| 339 |
|
| 340 |
ifeq ($(DEBUG), 1) |
| 341 |
EXTRA_CFLAGS += -g |
| 342 |
endif |
| 343 |
|
| 344 |
ifdef STATIC |
| 345 |
EXTRA_CFLAGS += -static |
| 346 |
endif |
| 347 |
|
| 348 |
ifdef UCS |
| 349 |
EXTRA_CFLAGS += -DD2U_UNICODE |
| 350 |
endif |
| 351 |
ifdef UNIFILE |
| 352 |
EXTRA_CFLAGS += -DD2U_UNIFILE |
| 353 |
endif |
| 354 |
|
| 355 |
|
| 356 |
ifdef LFS |
| 357 |
EXTRA_CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 |
| 358 |
endif |
| 359 |
|
| 360 |
LDFLAGS_USER = |
| 361 |
LDFLAGS = $(RPM_LD_FLAGS) $(LDFLAGS_EXTRA) $(LDFLAGS_USER) |
| 362 |
LIBS = $(LIBS_EXTRA) |
| 363 |
|
| 364 |
DEFS_USER = |
| 365 |
DEFS = $(EXTRA_DEFS) $(DEFS_USER) |
| 366 |
|
| 367 |
# .......................................................... targets ... |
| 368 |
|
| 369 |
all: $(BIN) $(MAC2UNIX_BIN) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) doc \ |
| 370 |
mofiles man |
| 371 |
|
| 372 |
status: |
| 373 |
@echo "D2U_OS = $(D2U_OS)" |
| 374 |
@echo "UCS = $(UCS)" |
| 375 |
@echo "CFLAGS = $(CFLAGS)" |
| 376 |
@echo "EXTRA_CFLAGS = $(EXTRA_CFLAGS)" |
| 377 |
@echo "LDFLAGS = $(LDFLAGS)" |
| 378 |
@echo "LIBS = $(LIBS)" |
| 379 |
|
| 380 |
common.o : common.c common.h dos2unix.h unix2dos.h version.mk |
| 381 |
$(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ |
| 382 |
|
| 383 |
querycp.o : querycp.c querycp.h |
| 384 |
$(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ |
| 385 |
|
| 386 |
dos2unix.o : dos2unix.c dos2unix.h querycp.h common.h |
| 387 |
$(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ |
| 388 |
|
| 389 |
unix2dos.o : unix2dos.c unix2dos.h querycp.h common.h |
| 390 |
$(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ |
| 391 |
|
| 392 |
$(BIN): dos2unix.o querycp.o common.o |
| 393 |
$(CC) $+ $(LDFLAGS) $(LIBS) -o $@ |
| 394 |
|
| 395 |
$(UNIX2DOS_BIN): unix2dos.o querycp.o common.o |
| 396 |
$(CC) $+ $(LDFLAGS) $(LIBS) -o $@ |
| 397 |
|
| 398 |
# DJGPP supports linking of .EXEs via 'stubify'. |
| 399 |
# See djgpp.mak and https://www.delorie.com/djgpp/v2faq/faq22_5.html |
| 400 |
# ln -s does automatic stubify in DJGPP 2.03. |
| 401 |
# This changed in DJGPP 2.05. DJGPP 2.05 emulates symbolic links. |
| 402 |
|
| 403 |
$(MAC2UNIX_BIN) : $(BIN) |
| 404 |
ifneq ($(DJGPP),) |
| 405 |
stubify -g $@ ; stubedit $@ runfile=$< |
| 406 |
else |
| 407 |
$(LINK) $< $@ |
| 408 |
endif |
| 409 |
|
| 410 |
|
| 411 |
$(UNIX2MAC_BIN) : $(UNIX2DOS_BIN) |
| 412 |
ifneq ($(DJGPP),) |
| 413 |
stubify -g $@ ; stubedit $@ runfile=$< |
| 414 |
else |
| 415 |
$(LINK) $< $@ |
| 416 |
endif |
| 417 |
|
| 418 |
$(MANPOTFILE) : man/man1/dos2unix.pod |
| 419 |
$(MAKE) -C man/man1 |
| 420 |
|
| 421 |
# WARNING: Backward-incompatibility since GNU make 3.82. |
| 422 |
# The pattern-specific variables and pattern rules are now applied in the |
| 423 |
# shortest stem first order instead of the definition order (variables |
| 424 |
# and rules with the same stem length are still applied in the definition |
| 425 |
# order). |
| 426 |
# In order to stay compatible with GNU make < 3.82 we put the rule with |
| 427 |
# the shortest stem first. |
| 428 |
|
| 429 |
po/%.po : $(POT) |
| 430 |
msgmerge --no-wrap -U $@ $(POT) --backup=numbered |
| 431 |
# change timestamp in case .po file was not updated. |
| 432 |
touch $@ |
| 433 |
|
| 434 |
$(MANPODFILES) &: $(MANPOFILES) man/man1/dos2unix.pod |
| 435 |
$(MAKE) -C man/man1 |
| 436 |
|
| 437 |
man/%/man1/dos2unix.pod : po-man/%.po |
| 438 |
$(MAKE) -C man/man1 |
| 439 |
|
| 440 |
# empty recipe to break circular dependency |
| 441 |
man/man1/dos2unix.pod : ; |
| 442 |
|
| 443 |
%.1 : %.pod |
| 444 |
$(MAKE) -C man/man1 PODCENTER=$(DOS2UNIX_DATE) $(subst man/,../,$@) |
| 445 |
|
| 446 |
mofiles: $(MOFILES) |
| 447 |
|
| 448 |
html: $(HTMLFILES_EN) $(HTMLFILES) |
| 449 |
|
| 450 |
txt: $(TXTFILES_EN) $(TXTFILES) |
| 451 |
|
| 452 |
ps: $(PSFILES_EN) $(PSFILES) |
| 453 |
|
| 454 |
pdf: $(PDFFILES_EN) $(PDFFILES) |
| 455 |
|
| 456 |
man: $(MANFILES_EN) $(MANFILES) $(MANPOTFILE) |
| 457 |
|
| 458 |
doc: txt html |
| 459 |
|
| 460 |
tags: $(POT) |
| 461 |
|
| 462 |
merge: $(POFILES) |
| 463 |
|
| 464 |
# Get new po files from the Translation Project. |
| 465 |
getpo: |
| 466 |
rsync -Lrtvz translationproject.org::tp/latest/dos2unix/ po/incoming/ |
| 467 |
|
| 468 |
getpoman: |
| 469 |
rsync -Lrtvz translationproject.org::tp/latest/dos2unix-man/ po-man/incoming/ |
| 470 |
|
| 471 |
%.mo : %.po |
| 472 |
msgfmt -c $< -o $@ |
| 473 |
|
| 474 |
$(POT) : dos2unix.c unix2dos.c common.c |
| 475 |
xgettext -C -cTRANSLATORS: --no-wrap --keyword=_ $+ -o $(POT) |
| 476 |
|
| 477 |
%.txt : %.pod |
| 478 |
pod2text $< > $@ |
| 479 |
|
| 480 |
README.txt INSTALL.txt NEWS.txt ChangeLog.txt COPYING.txt TODO.txt BUGS.txt: ; |
| 481 |
|
| 482 |
%.ps : %.1 |
| 483 |
groff -man $< -T ps > $@ |
| 484 |
|
| 485 |
%.pdf: %.ps |
| 486 |
ps2pdf $< $@ |
| 487 |
|
| 488 |
# Since perl 5.18 pod2html generates HTML with all non-ASCII characters encoded |
| 489 |
# with HTML Ampersand Character Codes. This seems to be better browser compatible |
| 490 |
# than HTML in UTF-8 format. PERL_UNICODE=SDA is needed to get a correct UTF-8 |
| 491 |
# encoded title. |
| 492 |
# With perl < 5.18 you have to remove PERL_UNICODE=SDA, and then you get HTML pages |
| 493 |
# in UTF-8 format. |
| 494 |
|
| 495 |
# Generic rule. |
| 496 |
%.$(HTMLEXT) : %.pod |
| 497 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - DOS/MAC to UNIX and vice versa text file format converter" $< > $@ |
| 498 |
|
| 499 |
man/de/man1/$(PACKAGE).$(HTMLEXT) : man/de/man1/$(PACKAGE).pod |
| 500 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - Formatumwandlung für Textdateien von DOS/Mac nach Unix und umgekehrt" $< > $@ |
| 501 |
|
| 502 |
man/es/man1/$(PACKAGE).$(HTMLEXT) : man/es/man1/$(PACKAGE).pod |
| 503 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - Convertidor de archivos de texto de formato DOS/Mac a Unix y viceversa" $< > $@ |
| 504 |
|
| 505 |
man/fr/man1/$(PACKAGE).$(HTMLEXT) : man/fr/man1/$(PACKAGE).pod |
| 506 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - Convertit les fichiers textes du format DOS/Mac vers Unix et inversement" $< > $@ |
| 507 |
|
| 508 |
man/it/man1/$(PACKAGE).$(HTMLEXT) : man/it/man1/$(PACKAGE).pod |
| 509 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - convertitore del file testo da dos/mac a unix e viceversa" $< > $@ |
| 510 |
|
| 511 |
man/ko/man1/$(PACKAGE).$(HTMLEXT) : man/ko/man1/$(PACKAGE).pod |
| 512 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - DOS/맥 에서 유닉스에서, 그 반대로의 텍스트 파일 형식 변환 프로그램" $< > $@ |
| 513 |
|
| 514 |
man/nl/man1/$(PACKAGE).$(HTMLEXT) : man/nl/man1/$(PACKAGE).pod |
| 515 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - DOS/Mac naar Unix en vice versa tekstbestand formaat omzetter" $< > $@ |
| 516 |
|
| 517 |
man/pl/man1/$(PACKAGE).$(HTMLEXT) : man/pl/man1/$(PACKAGE).pod |
| 518 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - konwerter formatu plików tekstowych między systemami DOS/Mac a Uniksem" $< > $@ |
| 519 |
|
| 520 |
man/pt_BR/man1/$(PACKAGE).$(HTMLEXT) : man/pt_BR/man1/$(PACKAGE).pod |
| 521 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - Conversor de formato de arquivo texto de DOS/Mac para Unix e vice-versa" $< > $@ |
| 522 |
|
| 523 |
man/ro/man1/$(PACKAGE).$(HTMLEXT) : man/ro/man1/$(PACKAGE).pod |
| 524 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - Convertor de format de fișier text din DOS/Mac în Unix și viceversa" $< > $@ |
| 525 |
|
| 526 |
man/sr/man1/$(PACKAGE).$(HTMLEXT) : man/sr/man1/$(PACKAGE).pod |
| 527 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - претварач формата текстуалних датотека из ДОС/Мек-а у Јуникс и обратно" $< > $@ |
| 528 |
|
| 529 |
man/sv/man1/$(PACKAGE).$(HTMLEXT) : man/sv/man1/$(PACKAGE).pod |
| 530 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - textfilsformatskonverterare från DOS/Mac till Unix och vice versa" $< > $@ |
| 531 |
|
| 532 |
man/uk/man1/$(PACKAGE).$(HTMLEXT) : man/uk/man1/$(PACKAGE).pod |
| 533 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - програма для перетворення даних у текстовому форматі DOS/Mac у формат Unix, і навпаки" $< > $@ |
| 534 |
|
| 535 |
man/zh_CN/man1/$(PACKAGE).$(HTMLEXT) : man/zh_CN/man1/$(PACKAGE).pod |
| 536 |
PERL_UNICODE=SDA pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - DOS/Mac - Unix文件格式转换器" $< > $@ |
| 537 |
|
| 538 |
test: all |
| 539 |
ifneq ($(DJGPP),) |
| 540 |
cd test; $(MAKE) test UCS= SHELL=$(shell which sh) |
| 541 |
else |
| 542 |
cd test; $(MAKE) test UCS=$(UCS) |
| 543 |
endif |
| 544 |
|
| 545 |
check: test |
| 546 |
|
| 547 |
install-bin: $(BIN) $(MAC2UNIX_BIN) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) |
| 548 |
$(MKDIR) -p -m 755 $(DESTDIR)$(bindir) |
| 549 |
$(INSTALL_PROGRAM) $(BIN) $(DESTDIR)$(bindir) |
| 550 |
$(INSTALL_PROGRAM) $(UNIX2DOS_BIN) $(DESTDIR)$(bindir) |
| 551 |
ifneq ($(DJGPP),) |
| 552 |
cd $(DESTDIR)$(bindir); stubify -g $(MAC2UNIX_BIN) ; stubedit $(MAC2UNIX_BIN) runfile=$(BIN) |
| 553 |
cd $(DESTDIR)$(bindir); stubify -g $(UNIX2MAC_BIN) ; stubedit $(UNIX2MAC_BIN) runfile=$(UNIX2DOS_BIN) |
| 554 |
else |
| 555 |
ifeq ($(LINK),cp -f) |
| 556 |
$(INSTALL_PROGRAM) $(MAC2UNIX_BIN) $(DESTDIR)$(bindir) |
| 557 |
$(INSTALL_PROGRAM) $(UNIX2MAC_BIN) $(DESTDIR)$(bindir) |
| 558 |
else |
| 559 |
cd $(DESTDIR)$(bindir); $(LINK) $(BIN) $(MAC2UNIX_BIN) |
| 560 |
cd $(DESTDIR)$(bindir); $(LINK) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) |
| 561 |
endif |
| 562 |
endif |
| 563 |
|
| 564 |
|
| 565 |
install-man: man |
| 566 |
$(MKDIR) -p -m 755 $(DESTDIR)$(man1dir) |
| 567 |
$(INSTALL_DATA) $(MANFILES_EN) $(DESTDIR)$(man1dir) |
| 568 |
ifeq ($(LINK_MAN),cp -f) |
| 569 |
$(INSTALL_DATA) $(MANFILES_EN) $(DESTDIR)$(man1dir)/$(MAC2UNIX).1 |
| 570 |
$(INSTALL_DATA) $(MANFILES_EN) $(DESTDIR)$(man1dir)/$(UNIX2DOS).1 |
| 571 |
$(INSTALL_DATA) $(MANFILES_EN) $(DESTDIR)$(man1dir)/$(UNIX2MAC).1 |
| 572 |
else |
| 573 |
cd $(DESTDIR)$(man1dir); $(LINK_MAN) $(PACKAGE).1 $(MAC2UNIX).1 |
| 574 |
cd $(DESTDIR)$(man1dir); $(LINK_MAN) $(PACKAGE).1 $(UNIX2DOS).1 |
| 575 |
cd $(DESTDIR)$(man1dir); $(LINK_MAN) $(PACKAGE).1 $(UNIX2MAC).1 |
| 576 |
endif |
| 577 |
ifdef ENABLE_NLS |
| 578 |
$(foreach manfile, $(MANFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ;) |
| 579 |
$(foreach manfile, $(MANFILES), $(INSTALL_DATA) $(manfile) $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ;) |
| 580 |
$(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(MAC2UNIX).1 ;) |
| 581 |
$(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2DOS).1 ;) |
| 582 |
$(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2MAC).1 ;) |
| 583 |
endif |
| 584 |
|
| 585 |
install-mo: mofiles |
| 586 |
ifdef ENABLE_NLS |
| 587 |
@echo "-- install-mo" |
| 588 |
$(foreach mofile, $(MOFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES ;) |
| 589 |
$(foreach mofile, $(MOFILES), $(INSTALL_DATA) $(mofile) $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;) |
| 590 |
endif |
| 591 |
|
| 592 |
install-doc: doc |
| 593 |
@echo "-- install-doc" |
| 594 |
$(MKDIR) -p -m 755 $(DESTDIR)$(docdir) |
| 595 |
$(INSTALL_DATA) $(INSTALL_OBJS_DOC) $(DESTDIR)$(docdir) |
| 596 |
$(INSTALL_DATA) $(TXTFILES_EN) $(DESTDIR)$(docdir) |
| 597 |
$(INSTALL_DATA) $(HTMLFILES_EN) $(DESTDIR)$(docdir) |
| 598 |
ifdef ENABLE_NLS |
| 599 |
$(foreach txtfile, $(TXTFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(txtfile),)) ;) |
| 600 |
$(foreach txtfile, $(TXTFILES), $(INSTALL_DATA) $(txtfile) $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(txtfile),)) ;) |
| 601 |
$(foreach htmlfile, $(HTMLFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(htmlfile),)) ;) |
| 602 |
$(foreach htmlfile, $(HTMLFILES), $(INSTALL_DATA) $(htmlfile) $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(htmlfile),)) ;) |
| 603 |
endif |
| 604 |
|
| 605 |
# No dependency. Install pdf/ps only when they have been manually generated. |
| 606 |
install-pdf: |
| 607 |
@echo "-- install-pdf" |
| 608 |
$(MKDIR) -p -m 755 $(DESTDIR)$(docdir) |
| 609 |
$(foreach pdffile, $(wildcard man/man1/*.pdf), $(INSTALL_DATA) $(pdffile) $(DESTDIR)$(docdir) ;) |
| 610 |
$(foreach psfile, $(wildcard man/man1/*.ps), $(INSTALL_DATA) $(psfile) $(DESTDIR)$(docdir) ;) |
| 611 |
ifdef ENABLE_NLS |
| 612 |
$(foreach pdffile, $(wildcard man/*/man1/*.pdf), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(pdffile),)) ;) |
| 613 |
$(foreach pdffile, $(wildcard man/*/man1/*.pdf), $(INSTALL_DATA) $(pdffile) $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(pdffile),)) ;) |
| 614 |
$(foreach psfile, $(wildcard man/*/man1/*.ps), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(psfile),)) ;) |
| 615 |
$(foreach psfile, $(wildcard man/*/man1/*.ps), $(INSTALL_DATA) $(psfile) $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(psfile),)) ;) |
| 616 |
endif |
| 617 |
|
| 618 |
install: install-bin install-man install-mo install-doc |
| 619 |
# Run a new instance of 'make' otherwise the $$(wildcard ) function my not have been expanded, |
| 620 |
# because the files may not have been there when make was started. |
| 621 |
$(MAKE) install-pdf |
| 622 |
|
| 623 |
uninstall: |
| 624 |
@echo "-- target: uninstall" |
| 625 |
-rm -f $(DESTDIR)$(bindir)/$(BIN) |
| 626 |
-rm -f $(DESTDIR)$(bindir)/$(MAC2UNIX_BIN) |
| 627 |
-rm -f $(DESTDIR)$(bindir)/$(UNIX2DOS_BIN) |
| 628 |
-rm -f $(DESTDIR)$(bindir)/$(UNIX2MAC_BIN) |
| 629 |
-rm -f $(DESTDIR)$(mandir)/man1/$(PACKAGE).1 |
| 630 |
-rm -f $(DESTDIR)$(mandir)/man1/$(MAC2UNIX).1 |
| 631 |
-rm -f $(DESTDIR)$(mandir)/man1/$(UNIX2DOS).1 |
| 632 |
-rm -f $(DESTDIR)$(mandir)/man1/$(UNIX2MAC).1 |
| 633 |
-rm -rf $(DESTDIR)$(docdir) |
| 634 |
ifdef ENABLE_NLS |
| 635 |
$(foreach mofile, $(MOFILES), rm -f $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES/$(PACKAGE).mo ;) |
| 636 |
$(foreach manfile, $(MANFILES), rm -f $(DESTDIR)$(datarootdir)/$(manfile) ;) |
| 637 |
$(foreach manfile, $(MANFILES), rm -f $(DESTDIR)$(datarootdir)/$(dir $(manfile))$(MAC2UNIX).1 ;) |
| 638 |
$(foreach manfile, $(MANFILES), rm -f $(DESTDIR)$(datarootdir)/$(dir $(manfile))$(UNIX2DOS).1 ;) |
| 639 |
$(foreach manfile, $(MANFILES), rm -f $(DESTDIR)$(datarootdir)/$(dir $(manfile))$(UNIX2MAC).1 ;) |
| 640 |
endif |
| 641 |
|
| 642 |
mostlyclean: |
| 643 |
rm -f *.o |
| 644 |
rm -f $(BIN) $(UNIX2DOS_BIN) $(MAC2UNIX_BIN) $(UNIX2MAC_BIN) |
| 645 |
rm -f *.bak *~ |
| 646 |
rm -f *.tmp |
| 647 |
rm -f man/man1/*.bak man/man1/*~ |
| 648 |
rm -f man/*/man1/*.bak man/*/man1/*~ |
| 649 |
rm -f po/*.bak po/*~ |
| 650 |
rm -f po/*.mo po-man/*~ |
| 651 |
cd test; $(MAKE) clean |
| 652 |
|
| 653 |
# Don't distribute PostScript and PDF manuals in the source package. |
| 654 |
# We don't want binary PDF files in the source package, because |
| 655 |
# some packagers check in the source files. PostScript is not used |
| 656 |
# a lot. |
| 657 |
|
| 658 |
clean: mostlyclean |
| 659 |
rm -f man/man1/*.ps |
| 660 |
rm -f man/man1/*.pdf |
| 661 |
rm -f man/*/man1/*.ps |
| 662 |
rm -f man/*/man1/*.pdf |
| 663 |
|
| 664 |
distclean: clean |
| 665 |
|
| 666 |
# Because there is so much trouble with generating man pages with |
| 667 |
# pod2man, due to old Perl versions (< 5.10.1) on many systems, I include the |
| 668 |
# man pages in the source tar file. |
| 669 |
# Old pod2man versions do not have the --utf8 option. Old pod2man, pod2text, |
| 670 |
# and pod2html do not support the =encoding command. |
| 671 |
# Perl 5.18 pod2man demands an =encoding command for Latin-1 encoded POD files. |
| 672 |
# |
| 673 |
# Newer perl/pod2man versions produce better output. It is better to include |
| 674 |
# man pages in the source package, than that people generate them themselves |
| 675 |
# with old perl versions. |
| 676 |
|
| 677 |
maintainer-clean: distclean |
| 678 |
@echo 'This command is intended for maintainers to use; it' |
| 679 |
@echo 'deletes files that may need special tools to rebuild.' |
| 680 |
rm -f man/man1/*.1 |
| 681 |
rm -f man/man1/*.txt |
| 682 |
rm -f man/man1/*.$(HTMLEXT) |
| 683 |
rm -f po-man/dos2unix-man.pot |
| 684 |
rm -f man/*/man1/*.1 |
| 685 |
rm -f man/*/man1/*.txt |
| 686 |
rm -f man/*/man1/*.pod |
| 687 |
rm -f man/*/man1/*.$(HTMLEXT) |
| 688 |
|
| 689 |
realclean: maintainer-clean |
| 690 |
|
| 691 |
|
| 692 |
ZIPOBJ = bin/$(BIN) \ |
| 693 |
bin/$(MAC2UNIX_BIN) \ |
| 694 |
bin/$(UNIX2DOS_BIN) \ |
| 695 |
bin/$(UNIX2MAC_BIN) \ |
| 696 |
share/man/man1/$(PACKAGE).1 \ |
| 697 |
share/man/man1/$(MAC2UNIX).1 \ |
| 698 |
share/man/man1/$(UNIX2DOS).1 \ |
| 699 |
share/man/man1/$(UNIX2MAC).1 \ |
| 700 |
share/doc/$(docsubdir)/*.* \ |
| 701 |
$(ZIPOBJ_EXTRA) |
| 702 |
|
| 703 |
ifdef ENABLE_NLS |
| 704 |
ZIPOBJ += share/locale/*/LC_MESSAGES/$(PACKAGE).mo |
| 705 |
ZIPOBJ += share/man/*/man1/$(PACKAGE).1 \ |
| 706 |
share/man/*/man1/$(MAC2UNIX).1 \ |
| 707 |
share/man/*/man1/$(UNIX2DOS).1 \ |
| 708 |
share/man/*/man1/$(UNIX2MAC).1 |
| 709 |
ZIPOBJ += share/doc/$(docsubdir)/*/* |
| 710 |
endif |
| 711 |
|
| 712 |
ZIPFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX)$(NLSSUFFIX).zip |
| 713 |
TGZFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX)$(NLSSUFFIX).tar.gz |
| 714 |
TBZFILE = $(PACKAGE)-$(DOS2UNIX_VERSION)$(VERSIONSUFFIX)$(NLSSUFFIX).tar.bz2 |
| 715 |
|
| 716 |
dist-convert/%: |
| 717 |
rm -f $(prefix)/$(ZIPFILE) |
| 718 |
cd $(prefix) ; $* --keepdate share/man/man1/$(PACKAGE).1 share/man/man1/$(MAC2UNIX).1 share/man/man1/$(UNIX2DOS).1 share/man/man1/$(UNIX2MAC).1 |
| 719 |
cd $(prefix) ; $* --keepdate --add-bom share/doc/$(docsubdir)/*.txt |
| 720 |
cd $(prefix) ; $* --keepdate share/doc/$(docsubdir)/*.$(HTMLEXT) |
| 721 |
ifdef ENABLE_NLS |
| 722 |
cd $(prefix) ; $* --keepdate share/man/*/man1/$(PACKAGE).1 share/man/*/man1/$(MAC2UNIX).1 share/man/*/man1/$(UNIX2DOS).1 share/man/*/man1/$(UNIX2MAC).1 |
| 723 |
cd $(prefix) ; $* --keepdate --add-bom share/doc/$(docsubdir)/*/*.txt |
| 724 |
cd $(prefix) ; $* --keepdate share/doc/$(docsubdir)/*/*.$(HTMLEXT) |
| 725 |
endif |
| 726 |
|
| 727 |
dist-zip: dist-convert/unix2dos |
| 728 |
cd $(prefix) ; zip -r $(ZIPFILE) $(ZIPOBJ) |
| 729 |
mv -f $(prefix)/$(ZIPFILE) .. |
| 730 |
|
| 731 |
dist-tgz: dist-convert/dos2unix |
| 732 |
cd $(prefix) ; tar cvzf $(TGZFILE) $(ZIPOBJ) |
| 733 |
mv $(prefix)/$(TGZFILE) .. |
| 734 |
|
| 735 |
dist-tbz: dist-convert/dos2unix |
| 736 |
cd $(prefix) ; tar cvjf $(TBZFILE) $(ZIPOBJ) |
| 737 |
mv $(prefix)/$(TBZFILE) .. |
| 738 |
|
| 739 |
dist: $(DIST_TARGET) |
| 740 |
|
| 741 |
strip: |
| 742 |
$(STRIP) $(BIN) |
| 743 |
$(STRIP) $(UNIX2DOS_BIN) |
| 744 |
ifeq ($(LINK),cp -f) |
| 745 |
$(STRIP) $(MAC2UNIX_BIN) |
| 746 |
$(STRIP) $(UNIX2MAC_BIN) |
| 747 |
endif |
| 748 |
|
| 749 |
# End of file |