diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-20 13:27:40 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-20 13:27:44 +0900 |
commit | 842ebc0fa15fca613e0c9fce10dd63fa09d27666 (patch) | |
tree | ac48c8ec511c025b1b479462056510eedc3ac6bc /Makefile | |
parent | 3d6ee8c3ccc0f65c7c87122dba80908ae751aa16 (diff) | |
download | dos2unix-842ebc0fa15fca613e0c9fce10dd63fa09d27666.tar.gz dos2unix-842ebc0fa15fca613e0c9fce10dd63fa09d27666.tar.bz2 dos2unix-842ebc0fa15fca613e0c9fce10dd63fa09d27666.zip |
Imported Upstream version 6.0.4
Change-Id: I3ce28283323425d17877da03683ac6a2b70f2382
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 113 |
1 files changed, 88 insertions, 25 deletions
@@ -1,6 +1,6 @@ # Author: Erwin Waterlander # -# Copyright (C) 2009-2012 Erwin Waterlander +# Copyright (C) 2009-2013 Erwin Waterlander # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -35,9 +35,10 @@ include version.mk +.PHONY: man txt html pdf mofiles tags merge -CC = gcc -CPP = cpp +CC ?= gcc +CPP ?= cpp CPP_FLAGS_POD = ALL STRIP = strip @@ -52,6 +53,10 @@ ENABLE_NLS = 1 LFS = 1 DEBUG = 0 UCS = 1 +# I can set MAN_NONLATIN to 1, despite the compilation issues with old Perl +# versions, because I'm going to include the non-Latin1 manual files into the +# source package. +MAN_NONLATIN = 1 EXE= @@ -92,7 +97,7 @@ HTMLEXT = htm # By default we generate only English text and html manuals. # Then we don't need "pod2text --utf8" and we have no dependency on iconv. DOCFILES = man/man1/$(PACKAGE).txt man/man1/$(PACKAGE).$(HTMLEXT) -INSTALL_OBJS_DOC = README.txt NEWS.txt ChangeLog.txt COPYING.txt TODO.txt BUGS.txt $(DOCFILES) +INSTALL_OBJS_DOC = README.txt INSTALL.txt NEWS.txt ChangeLog.txt COPYING.txt TODO.txt BUGS.txt $(DOCFILES) PODFILES_ALL = man/man1/dos2unix.pod $(wildcard man/*/man1/dos2unix.pod) PODFILES = $(wildcard man/*/man1/dos2unix.pod) @@ -133,8 +138,9 @@ endif ifeq (cygwin,$(D2U_OS)) ifdef ENABLE_NLS - LDFLAGS_EXTRA = -lintl -liconv -Wl,--enable-auto-import + LIBS_EXTRA = -lintl -liconv endif + LDFLAGS_EXTRA = -Wl,--enable-auto-import EXE = .exe # allow non-cygwin clients which do not understand cygwin # symbolic links to launch applications... @@ -146,17 +152,20 @@ endif # documentation directories. docsubdir = $(PACKAGE) VERSIONSUFFIX = -cygwin + MAN_NONLATIN = 1 endif ifndef D2U_OS ifeq ($(findstring MSYS,$(shell uname)),MSYS) + CC=gcc D2U_OS = msys EXE = .exe VERSIONSUFFIX = -msys EO_XNOTATION=1 UCS = + MAN_NONLATIN = ifdef ENABLE_NLS - LDFLAGS_EXTRA = -lintl -liconv + LIBS_EXTRA = -lintl -liconv endif endif endif @@ -169,10 +178,14 @@ ifeq ($(findstring MINGW32,$(shell uname)),MINGW32) VERSIONSUFFIX = -win32 LINK = cp -f EO_XNOTATION=1 + MAN_NONLATIN = ifdef ENABLE_NLS - LDFLAGS_EXTRA = -lintl -liconv + LIBS_EXTRA = -lintl -liconv ZIPOBJ_EXTRA = bin/libintl-8.dll bin/libiconv-2.dll endif +ifeq ($(findstring w64-mingw32,$(shell gcc -dumpmachine)),w64-mingw32) + CFLAGS_COMPILER = -DD2U_COMPILER=MINGW32_W64 +endif endif endif @@ -186,9 +199,10 @@ ifneq ($(DJGPP),) docsubdir = dos2unix EO_XNOTATION=1 UCS = + MAN_NONLATIN = ZIPOBJ_EXTRA = bin/cwsdpmi.exe ifdef ENABLE_NLS - LDFLAGS_EXTRA = -lintl -liconv + LIBS_EXTRA = -lintl -liconv endif endif endif @@ -202,9 +216,10 @@ ifeq ($(shell uname),OS/2) LINK_MAN = cp -f EO_XNOTATION=1 UCS = + MAN_NONLATIN = LDFLAGS_EXTRA = -Zargs-wild ifdef ENABLE_NLS - LDFLAGS_EXTRA += -lintl -liconv + LIBS_EXTRA += -lintl -liconv endif endif endif @@ -214,7 +229,8 @@ ifeq (FreeBSD, $(shell uname -s)) D2U_OS = freebsd ifdef ENABLE_NLS CFLAGS_OS = -I/usr/local/include - LDFLAGS_EXTRA = -lintl -L/usr/local/lib + LDFLAGS_EXTRA = -L/usr/local/lib + LIBS_EXTRA = -lintl endif endif endif @@ -223,7 +239,8 @@ ifeq (Darwin, $(shell uname -s)) D2U_OS = Darwin ifdef ENABLE_NLS CFLAGS_OS = -I/usr/local/include - LDFLAGS_EXTRA = -lintl -L/usr/local/lib + LDFLAGS_EXTRA = -L/usr/local/lib + LIBS_EXTRA = -lintl endif endif @@ -236,7 +253,7 @@ endif ifeq (sun,$(D2U_OS)) # Running under SunOS/Solaris - LDFLAGS_EXTRA = -lintl + LIBS_EXTRA = -lintl endif ifndef D2U_OS @@ -263,14 +280,27 @@ ifdef EO_XNOTATION EO_NOTATION = -x endif +ifeq ($(MAN_NONLATIN),1) +PODFILES_NONLATIN = $(wildcard man/nonlatin/*/man1/dos2unix.pod) +MANFILES_NONLATIN = $(patsubst %.pod,%.1,$(PODFILES_NONLATIN)) +TXTFILES_NONLATIN = $(patsubst %.pod,%.txt,$(PODFILES_NONLATIN)) +HTMLFILES_NONLATIN = $(patsubst %.pod,%.$(HTMLEXT),$(PODFILES_NONLATIN)) +# PostScript and PDF generation from UTF-8 manuals is not working, +# or I don't know how to do it. +#PSFILES_NONLATIN = $(patsubst %.pod,%.ps,$(PODFILES_NONLATIN)) +#PDFFILES_NONLATIN = $(patsubst %.pod,%.pdf,$(PODFILES_NONLATIN)) +endif + CFLAGS_USER = -CFLAGS = -O2 -Wall $(RPM_OPT_FLAGS) $(CPPFLAGS) $(CFLAGS_USER) +CFLAGS ?= -O2 +CFLAGS += -Wall $(RPM_OPT_FLAGS) $(CPPFLAGS) $(CFLAGS_USER) EXTRA_CFLAGS = -DVER_REVISION=\"$(DOS2UNIX_VERSION)\" \ -DVER_DATE=\"$(DOS2UNIX_DATE)\" \ -DVER_AUTHOR=\"$(DOS2UNIX_AUTHOR)\" \ -DDEBUG=$(DEBUG) \ - $(CFLAGS_OS) + $(CFLAGS_OS) \ + $(CFLAGS_COMPILER) ifeq ($(DEBUG), 1) EXTRA_CFLAGS += -g @@ -290,19 +320,22 @@ endif LDFLAGS_USER = LDFLAGS = $(RPM_OPT_FLAGS) $(LDFLAGS_EXTRA) $(LDFLAGS_USER) +LIBS = $(LIBS_EXTRA) DEFS_USER = DEFS = $(EXTRA_DEFS) $(DEFS_USER) # .......................................................... targets ... -all: $(BIN) $(MAC2UNIX_BIN) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) $(DOCFILES) $(MOFILES) $(EOX_POFILES) $(MANFILES) man/man1/dos2unix.1 +all: $(BIN) $(MAC2UNIX_BIN) $(UNIX2DOS_BIN) $(UNIX2MAC_BIN) $(DOCFILES) $(MOFILES) $(EOX_POFILES) man/man1/dos2unix.1 $(MANFILES) $(MANFILES_NONLATIN) status: @echo "D2U_OS = $(D2U_OS)" @echo "UCS = $(UCS)" @echo "CFLAGS = $(CFLAGS)" @echo "EXTRA_CFLAGS = $(EXTRA_CFLAGS)" + @echo "LDFLAGS = $(LDFLAGS)" + @echo "LIBS = $(LIBS)" common.o : common.c common.h $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ @@ -310,38 +343,40 @@ common.o : common.c common.h querycp.o : querycp.c querycp.h $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ -dos2unix.o : dos2unix.c dos2unix.h querycp.h common.h +dos2unix.o : dos2unix.c dos2unix.h querycp.h common.h version.mk $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ -unix2dos.o : unix2dos.c unix2dos.h querycp.h common.h +unix2dos.o : unix2dos.c unix2dos.h querycp.h common.h version.mk $(CC) $(DEFS) $(EXTRA_CFLAGS) $(DOS2UNIX_NLSDEFS) $(CFLAGS) -c $< -o $@ $(BIN): dos2unix.o querycp.o common.o - $(CC) $+ $(LDFLAGS) -o $@ + $(CC) $+ $(LDFLAGS) $(LIBS) -o $@ $(UNIX2DOS_BIN): unix2dos.o querycp.o common.o - $(CC) $+ $(LDFLAGS) -o $@ + $(CC) $+ $(LDFLAGS) $(LIBS) -o $@ $(MAC2UNIX_BIN) : $(BIN) $(LINK) $< $@ %.1 : %.pod - $(MAKE) -C man/man1 + $(MAKE) -C man/man1 MAN_NONLATIN=$(MAN_NONLATIN) $(UNIX2MAC_BIN) : $(UNIX2DOS_BIN) $(LINK) $< $@ mofiles: $(MOFILES) -html: $(HTMLFILES) +html: $(HTMLFILES) $(HTMLFILES_NONLATIN) -txt: $(TXTFILES) +txt: $(TXTFILES) $(TXTFILES_NONLATIN) -ps: $(PSFILES) +ps: $(PSFILES) $(PSFILES_NONLATIN) -pdf: $(PDFFILES) +pdf: $(PDFFILES) $(PDFFILES_NONLATIN) -doc: $(DOCFILES) $(MANFILES) man/man1/dos2unix.1 +man: man/man1/dos2unix.1 $(MANFILES) $(MANFILES_NONLATIN) + +doc: $(DOCFILES) tags: $(POT) @@ -375,6 +410,10 @@ $(POT) : dos2unix.c unix2dos.c common.c man/man1/$(PACKAGE).txt : man/man1/$(PACKAGE).pod pod2text $< > $@ +# Non-Latin1 script manuals are already in UTF-8 format. +man/nonlatin/ru/man1/$(PACKAGE).txt : man/nonlatin/ru/man1/$(PACKAGE).pod + pod2text $< > $@ + %.ps : %.1 groff -man $< -T ps > $@ @@ -401,6 +440,9 @@ man/nl/man1/$(PACKAGE).$(HTMLEXT) : man/nl/man1/$(PACKAGE).ut8 man/es/man1/$(PACKAGE).$(HTMLEXT) : man/es/man1/$(PACKAGE).ut8 pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - Convertidor de archivos de texto de formato DOS/Mac a Unix y viceversa" $< > $@ +man/nonlatin/ru/man1/$(PACKAGE).$(HTMLEXT) : man/nonlatin/ru/man1/$(PACKAGE).pod + pod2html --title="$(PACKAGE) $(DOS2UNIX_VERSION) - DOS/MAC to UNIX and vice versa text file format converter" $< > $@ + install: all $(MKDIR) -p -m 755 $(DESTDIR)$(bindir) $(INSTALL) -m 755 $(BIN) $(DESTDIR)$(bindir) @@ -428,6 +470,11 @@ endif $(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(MAC2UNIX).1 ;) $(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2DOS).1 ;) $(foreach manfile, $(MANFILES), cd $(DESTDIR)$(datarootdir)/$(dir $(manfile)) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2MAC).1 ;) + $(foreach manfile, $(MANFILES_NONLATIN), $(MKDIR) -p -m 755 $(DESTDIR)$(datarootdir)/$(subst nonlatin/,,$(dir $(manfile))) ;) + $(foreach manfile, $(MANFILES_NONLATIN), $(INSTALL) -m 644 $(manfile) $(DESTDIR)$(datarootdir)/$(subst nonlatin/,,$(dir $(manfile))) ;) + $(foreach manfile, $(MANFILES_NONLATIN), cd $(DESTDIR)$(datarootdir)/$(subst nonlatin/,,$(dir $(manfile))) ; $(LINK_MAN) $(PACKAGE).1 $(MAC2UNIX).1 ;) + $(foreach manfile, $(MANFILES_NONLATIN), cd $(DESTDIR)$(datarootdir)/$(subst nonlatin/,,$(dir $(manfile))) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2DOS).1 ;) + $(foreach manfile, $(MANFILES_NONLATIN), cd $(DESTDIR)$(datarootdir)/$(subst nonlatin/,,$(dir $(manfile))) ; $(LINK_MAN) $(PACKAGE).1 $(UNIX2MAC).1 ;) ifdef ENABLE_NLS @echo "-- install-mo" $(foreach mofile, $(MOFILES), $(MKDIR) -p -m 755 $(DESTDIR)$(localedir)/$(basename $(notdir $(mofile)))/LC_MESSAGES ;) @@ -453,6 +500,10 @@ install-doc: $(INSTALL_OBJS_DOC) $(foreach psfile, $(wildcard man/*/man1/*.ps), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(psfile),)) ;) $(foreach psfile, $(wildcard man/*/man1/*.ps), $(INSTALL) -m 644 $(psfile) $(DESTDIR)$(docdir)/$(word 2,$(subst /, ,$(psfile),)) ;) $(foreach psfile, $(wildcard man/man1/*.ps), $(INSTALL) -m 644 $(psfile) $(DESTDIR)$(docdir) ;) + $(foreach txtfile, $(wildcard man/nonlatin/*/man1/*.txt), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 3,$(subst /, ,$(txtfile),)) ;) + $(foreach txtfile, $(wildcard man/nonlatin/*/man1/*.txt), $(INSTALL) -m 644 $(txtfile) $(DESTDIR)$(docdir)/$(word 3,$(subst /, ,$(txtfile),)) ;) + $(foreach htmlfile, $(wildcard man/nonlatin/*/man1/*.$(HTMLEXT)), $(MKDIR) -p -m 755 $(DESTDIR)$(docdir)/$(word 3,$(subst /, ,$(htmlfile),)) ;) + $(foreach htmlfile, $(wildcard man/nonlatin/*/man1/*.$(HTMLEXT)), $(INSTALL) -m 644 $(htmlfile) $(DESTDIR)$(docdir)/$(word 3,$(subst /, ,$(htmlfile),)) ;) uninstall: @echo "-- target: uninstall" @@ -468,6 +519,7 @@ endif -rm -f $(DESTDIR)$(mandir)/man1/$(UNIX2DOS).1 -rm -f $(DESTDIR)$(mandir)/man1/$(UNIX2MAC).1 $(foreach manfile, $(MANFILES), rm -f $(DESTDIR)$(datarootdir)/$(manfile) ;) + $(foreach manfile, $(MANFILES_NONLATIN), rm -f $(DESTDIR)$(datarootdir)/$(subst nonlatin/,,$(manfile)) ;) -rm -rf $(DESTDIR)$(docdir) mostlyclean: @@ -493,12 +545,23 @@ clean: mostlyclean rm -f man/*/man1/*.ps rm -f man/*/man1/*.pdf rm -f man/*/man1/*.ut8 + rm -f man/nonlatin/*/man1/*.ps + rm -f man/nonlatin/*/man1/*.pdf distclean: clean +# Because there is so much trouble with generating non-Latin1 man pages with +# pod2man, due to old Perl versions (< 5.10.1) on many systems, I include the +# non-Latin1 man pages in the source tar file. +# Old pod2man versions do not have the --utf8 option. Old pod2man, pod2text, +# and pod2html do not support the =encoding command. + maintainer-clean: distclean @echo 'This command is intended for maintainers to use; it' @echo 'deletes files that may need special tools to rebuild.' + rm -f man/nonlatin/*/man1/*.txt + rm -f man/nonlatin/*/man1/*.$(HTMLEXT) + rm -f man/nonlatin/*/man1/*.1 realclean: maintainer-clean |