GNUmakefile.template 13.5 KB
Newer Older
1 2 3 4 5 6
######################################################################
# Begin of dvdisaster makefile template
######################################################################

# Currently supported locales

7
PO_LOCALES = pt_BR cs de it ru sv
8
MAN_LOCALES = de
9 10 11 12

# Search for TAGS: online-docs
# Don't forget edit NODIST for new doc locales

13 14 15 16 17
# Local settings (not changeable from the configure script)

# Where to put tar archives (arch, srcdist)
TAR_PREFIX=/dev/shm

18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
######################################################################
# Take over variables from configure
######################################################################

VERSION = $(CFG_VERSION)

SRCDIR = $(CFG_SRCDIR)
PKGNAME = $(CFG_PKGNAME)
PREFIX = $(CFG_PREFIX)
BINDIR = $(CFG_BINDIR)
MANDIR = $(CFG_MANDIR)
DOCDIR = $(CFG_DOCDIR)
DOCSUBDIR = $(CFG_DOCDIR)/$(CFG_DOCSUBDIR)
LOCALEDIR = $(CFG_LOCALEDIR)
BUILDROOT = $(CFG_BUILDROOT)
33
BUILDTMP = $(CFG_BUILDTMP)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

INTL_INCL   = $(CFG_INTL_INCL)
INTL_LFLAGS = $(CFG_INTL_LFLAGS)
INTL_LIBS   = $(CFG_INTL_LIBS)

CAM_LFLAGS = $(CFG_CAM_LFLAGS)
CAM_LIBS   = $(CFG_CAM_LIBS)

GTK_CFLAGS   = $(CFG_GTK2_CFLAGS)
GTK_LIBS     = $(CFG_GTK2_LIBS)
GTK_BINDIR   = $(CFG_GTK2_BINDIR)

EFENCE_LFLAGS = $(CFG_EFENCE_LFLAGS)
EFENCE_LIBS   = $(CFG_EFENCE_LIBS)

SYS_OPTIONS  = $(CFG_SYS_OPTIONS)
50
SYS_NAME     = $(CFG_SYS_NAME)
51 52 53 54
HAVE_OPTIONS = $(CFG_HAVE_OPTIONS)
WITH_OPTIONS = $(CFG_WITH_OPTIONS)
OTHER_OPTIONS = $(CFG_OTHER_OPTIONS) -DVERSION=\"$(VERSION)\"
SSE2_OPTIONS = $(CFG_SSE2_OPTIONS)
55
ALTIVEC_OPTIONS = $(CFG_ALTIVEC_OPTIONS)
56 57

LOCATIONS = -DSRCDIR=\"$(SRCDIR)\" -DBINDIR=\"$(BINDIR)\" -DDOCDIR=\"$(DOCSUBDIR)\" -DLOCALEDIR=\"$(LOCALEDIR)\"
58 59
COPTS = $(CFLAGS) $(LOCATIONS) $(SYS_OPTIONS) $(SYS_NAME) $(HAVE_OPTIONS) $(WITH_OPTIONS) $(OTHER_OPTIONS) $(INTL_INCL) $(CAM_INCL) $(GTK_CFLAGS) $(MUDFLAP_CFLAGS)
LOPTS = $(LDFLAGS) $(INTL_LFLAGS) $(CAM_LFLAGS) $(EFENCE_LFLAGS) $(MUDFLAP_LFLAGS)
60

61
LIBS = $(INTL_LIBS) $(CAM_LIBS) $(GTK_LIBS) $(EFENCE_LIBS) $(MUDFLAP_LIBS) -lm
62 63 64 65 66 67 68 69 70 71

CFILES = $(CFG_CFILES)
OFILES = $(CFG_OFILES)

######################################################################
# Compilation related
######################################################################

.PHONY : all help show locale time-stamp

72 73 74
${BUILDTMP}/%.o : %.c
	@echo "Compiling:" $?
	@$(CC) $(COPTS) -c $? -o $@
75

76
all: time-stamp dvdisaster
77 78 79 80 81 82 83

# Building the dvdisaster binary

time-stamp:
	@$(SRCDIR)/scripts/time-stamper.bash $(SRCDIR)/build.h

dvdisaster: inlined-icons.h $(OFILES) 
84 85
	@echo "Linking  : dvdisaster"
	@$(CC) $(LOPTS) $(OFILES) $(LIBS) -o dvdisaster
86 87 88 89 90 91 92 93 94 95 96 97 98 99
	@if test -e locale/de/LC_MESSAGES/dvdisaster.mo \
	 || echo $(WITH_OPTIONS) | grep "NLS_NO" >/dev/null; \
	then echo "not touching locale"; \
	else $(MAKE) --no-print-directory -C locale; \
	fi

inlined-icons.h: icons/read.png icons/create.png icons/scan.png icons/fix.png icons/verify.png
	@gdk-pixbuf-csource --raw --name=dvdisaster_read     icons/read.png      >inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_create   icons/create.png   >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_scan     icons/scan.png     >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_fix      icons/fix.png      >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_verify   icons/verify.png   >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_open_ecc icons/open-ecc.png >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_open_img icons/open-img.png >>inlined-icons.h
100 101 102 103 104 105 106 107
	@gdk-pixbuf-csource --raw --name=dvdisaster_cd icons/cd.png >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_gtk_help icons/gtk-help.png >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_gtk_index icons/gtk-index.png >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_gtk_preferences icons/gtk-preferences.png >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_gtk_quit icons/gtk-quit.png >>inlined-icons.h
	@gdk-pixbuf-csource --raw --name=dvdisaster_gtk_stop icons/gtk-stop.png >>inlined-icons.h

$(BUILDTMP)/help-dialogs.o: help-dialogs.c simple-md5sum
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
	@if test -e fingerprints.md5; \
	then if test -e help-dialogs.h; then rm help-dialogs.h; fi; \
	     mv inlined-icons.h inlined-icons.saved; \
	     mv build.h build.saved; \
	     ./simple-md5sum -b *.h *.c | sort -k2 >tmp.md5; \
	     sort -k2 < fingerprints.md5 >tmp2.md5; \
	     mv inlined-icons.saved inlined-icons.h; \
	     mv build.saved build.h; \
	     if ! cmp tmp2.md5 tmp.md5 >/dev/null; \
	     then echo "#define MODIFIED_SOURCE 1" >> help-dialogs.h; \
	     else echo "#define UNMODIFIED_SOURCE 1" >> help-dialogs.h; \
	     fi; \
	     rm tmp.md5 tmp2.md5; \
	else echo "#define MODIFIED_SOURCE 1" >> help-dialogs.h; \
	fi
123 124
	@echo "Compiling:" help-dialogs.c
	@$(CC) $(COPTS) -c help-dialogs.c -o $(BUILDTMP)/help-dialogs.o
125

126 127 128 129 130 131 132
$(BUILDTMP)/rs-encoder-sse2.o: rs-encoder-sse2.c
	@echo "Compiling:" rs-encoder-sse2.c
	@$(CC) $(SSE2_OPTIONS) $(COPTS) -c rs-encoder-sse2.c -o $(BUILDTMP)/rs-encoder-sse2.o

$(BUILDTMP)/rs-encoder-altivec.o: rs-encoder-altivec.c
	@echo "Compiling:" rs-encoder-altivec.c
	@$(CC) $(ALTIVEC_OPTIONS) $(COPTS) -c rs-encoder-altivec.c -o $(BUILDTMP)/rs-encoder-altivec.o
133 134 135 136

locale:
	@$(MAKE) --no-print-directory -C locale

137 138 139
untranslated:
	@$(MAKE) --no-print-directory -C locale check-untranslated

140
simple-md5sum: md5.c
141 142 143 144 145 146 147 148 149 150 151 152
	@$(CC) $(COPTS) $(MUDFLAP_CFLAGS) -DSIMPLE_MD5SUM md5.c $(MUDFLAP_LFLAGS) $(MUDFLAP_LIBS) -o simple-md5sum

version.tex:
	@echo "\\newcommand{\\projectversion}{$(VERSION)}" >$(SRCDIR)/documentation/config/version.tex

manual: version.tex
	@echo "Producing user manual... "
	@$(MAKE) --no-print-directory -C documentation/user-manual manual.pdf

manualclean:
	@echo "Removing temporary user manual files... "
	@$(MAKE) --no-print-directory -C documentation/user-manual clean
153 154 155 156 157 158 159 160 161 162 163 164


# Some usage info

help:
	@echo "Building dvdisaster:"
	@echo "show      - show current configuration (taken over from ./configure)"
	@echo "all       - build dvdisaster"
	@echo "install   - install dvdisaster locally"
	@echo "uninstall - uninstall dvdisaster"
	@echo
	@echo "Documentation related:"
165 166 167 168 169
	@echo "manual    - create the user manual (requires LaTeX)"
	@echo 
	@echo "Locale related:"
	@echo "locale    - update locale files"
	@echo "untranslated - show untranslated German strings"
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
	@echo 
	@echo "Package maintenance:"
	@echo "clean     - remove all easily rebuildable files"
	@echo "distclean - remove all files which are rebuildable"
	@echo "archclean - remove all files which are rebuildable in an development setup"
	@echo "arch      - distclean and tar the source directory (dirty)"
	@echo "srcdist   - produce the source distribution tarball (polished)"

# Build configuration printing

show: 
	@echo -e "Current build configuration in ./GNUmakefile:\n" 
	@echo "VERSION      = " $(VERSION)
	@echo "CC           = " $(CC)
	@echo "MAKE         = " $(MAKE)
	@echo "SHELL        = " $(SHELL)
	@echo "SRCDIR       = " $(SRCDIR)
	@echo "PKGNAME      = " $(PKGNAME)
	@echo "PREFIX       = " $(PREFIX)
	@echo "BINDIR       = " $(BINDIR)
	@echo "MANDIR       = " $(MANDIR)
	@echo "LOCALEDIR    = " $(LOCALEDIR)
	@echo "DOCDIR       = " $(DOCDIR)
	@echo "DOCSUBDIR    = " $(DOCSUBDIR)
	@echo "BUILDROOT    = " $(BUILDROOT)
195
	@echo "BUILDTMP     = " $(BUILDTMP)
196 197 198 199 200 201 202 203 204 205 206
	@echo
	@echo "INTL_INCL    = " $(INTL_INCL)
	@echo "INTL_LFLAGS  = " $(INTL_LFLAGS)
	@echo "INTL_LIBS    = " $(INTL_LIBS)
	@echo "GTK_CFLAGS   = " $(GTK_CFLAGS)
	@echo "GTK_LIBS     = " $(GTK_LIBS)
	@echo "GTK_BINDIR   = " $(GTK_BINDIR)
	@echo "EFENCE_LFLAGS= " $(EFENCE_LFLAGS)
	@echo "EFENCE_LIBS  = " $(EFENCE_LIBS)
	@echo
	@echo "SYS_OPTIONS  = " $(SYS_OPTIONS)
207
	@echo "SYS_NAME     = " $(SYS_NAME)
208 209 210 211
	@echo "HAVE_OPTIONS = " $(HAVE_OPTIONS)
	@echo "WITH_OPTIONS = " $(WITH_OPTIONS)
	@echo "OTHER_OPTIONS= " $(OTHER_OPTIONS)
	@echo "SSE2_OPTIONS = " $(SSE2_OPTIONS)
212
	@echo "ALTIVEC_OPTIONS= " $(ALTIVEC_OPTIONS)
213 214 215 216 217 218 219 220 221 222 223
	@echo
	@echo "CFLAGS       = " $(CFLAGS)
	@echo "COPTS        = " $(COPTS)
	@echo "LIBS         = " $(LIBS)
	@echo "LOPTS        = " $(LOPTS)

######################################################################
# Distribution management
######################################################################

.PHONY : install uninstall clean distclean arch
224
.PHONY : srcdist
225

226
install: dvdisaster manual
227 228
	@echo "Installing package..."
	install -d $(BUILDROOT)$(BINDIR)
229
	install dvdisaster $(BUILDROOT)$(BINDIR)
230 231 232 233 234 235
	install -d $(BUILDROOT)$(DOCSUBDIR)
	install -m 644 CHANGELOG $(BUILDROOT)$(DOCSUBDIR)
	install -m 644 COPYING $(BUILDROOT)$(DOCSUBDIR)
	install -m 644 CREDITS* $(BUILDROOT)$(DOCSUBDIR)
	install -m 644 README.MODIFYING $(BUILDROOT)$(DOCSUBDIR)
	install -m 644 TODO $(BUILDROOT)$(DOCSUBDIR)
236 237
	install -d $(BUILDROOT)$(DOCSUBDIR)
	(cd documentation/user-manual; install -m 644 manual.pdf $(BUILDROOT)$(DOCSUBDIR))
238 239 240 241
	install -d $(BUILDROOT)$(MANDIR)/man1
	install -d $(BUILDROOT)$(MANDIR)/de/man1
	cd documentation; \
	  ESCAPED_DOCSUBDIR=`echo $(DOCSUBDIR) | sed -e 's/\//\\\\\//g'`; \
242
	  sed "s/%docdir%/$$ESCAPED_DOCSUBDIR\/html/" <dvdisaster.en.1 >dvdisaster.updated; \
243
	  install -m 644 dvdisaster.updated $(BUILDROOT)$(MANDIR)/man1/dvdisaster.1; \
244
	  sed "s/%docdir%/$$ESCAPED_DOCSUBDIR\/html/" <dvdisaster.de.1 >dvdisaster.updated; \
245 246 247 248
	  install -m 644 dvdisaster.updated $(BUILDROOT)$(MANDIR)/de/man1/dvdisaster.1; \
	  rm dvdisaster.updated
	if echo $(WITH_OPTIONS) | grep "NLS_YES" >/dev/null; then \
	  cd locale; \
249
	  for i in ?? ??_??; do\
250 251 252 253 254 255 256
	    install -d $(BUILDROOT)$(LOCALEDIR)/$$i/LC_MESSAGES; \
	    install -m 644 $$i/LC_MESSAGES/dvdisaster.mo $(BUILDROOT)$(LOCALEDIR)/$$i/LC_MESSAGES; \
	  done \
	fi
	@echo "# dvdisaster uninstaller script" > $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "# Usage: sh dvdisaster-uninstall.sh" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
257 258 259 260 261 262 263 264 265
	@echo "rm -f \"$(BINDIR)/dvdisaster\" \"$(BINDIR)/dvdisaster-uninstall.sh\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/CHANGELOG\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/COPYING\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/CREDITS.de\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/CREDITS.en\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/manual.pdf\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/README.MODIFYING\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rm -f \"$(DOCSUBDIR)/TODO\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
	@echo "rmdir \"$(DOCSUBDIR)\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh	
266
	@for i in $(PO_LOCALES); do \
267
	  echo "rm -f \"$(LOCALEDIR)/$$i/LC_MESSAGES/dvdisaster.mo\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh ; \
268
	done
269
	@echo "rm -f \"$(MANDIR)/man1/dvdisaster.1\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
270
	@for i in $(MAN_LOCALES); do \
271
	  echo "rm -f \"$(MANDIR)/$$i/man1/dvdisaster.1\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh ; \
272 273
	done
	@echo "echo \"dvdisaster has been uninstalled.\"" >> $(BUILDROOT)$(BINDIR)/dvdisaster-uninstall.sh
274

275 276
uninstall:
	@echo "Uninstalling package..."
277
	rm -f $(BINDIR)/dvdisaster $(BINDIR)/dvdisaster-uninstall.sh
278 279 280 281 282 283 284 285 286 287 288
	rm -rf $(DOCSUBDIR)
	rm -f $(MANDIR)/man1/dvdisaster.1
	for i in $(PO_LOCALES); do \
	   rm $(LOCALEDIR)/$$i/LC_MESSAGES/dvdisaster.mo; \
	done
	for i in $(MAN_LOCALES); do \
	   rm $(MANDIR)/$$i/man1/dvdisaster.1; \
	done

archclean: distclean
	@echo "Removing rebuildable documentation parts"
289 290
	@$(MAKE) --no-print-directory -C $(SRCDIR)/documentation/codec-specs archclean
	@$(MAKE) --no-print-directory -C $(SRCDIR)/documentation/user-manual archclean
291 292 293 294

distclean: clean
	@echo "Removing configuration files"
	@rm -f configure.log Makefile.config GNUmakefile locale/Makefile
295
	@for i in locale/?? locale/??_??; do rm -rf $$i; done
296 297 298 299 300
	@echo "all:" >>GNUmakefile
	@echo -e "\t@echo" >>GNUmakefile
	@echo -e "\t@echo \"Please create a Makefile by entering \\\"bash configure\\\" first\"" >>GNUmakefile
	@echo -e "\t@echo" >>GNUmakefile

301 302 303 304 305
# There might be a not executable simple-md5sum from a compiler run
# under a different architecture, so make sure we have a working binary
# in the clean target.

clean:
306
	@echo "Removing rebuildable files"
307
	@rm -rf *.o $(BUILDTMP)/*.o medium.* abbild.* dvdisaster .dvdisaster core core.* *.core
308 309 310 311
	@rm -f inlined-icons.h help-dialogs.h
	@find . -name \*\~ -print | xargs rm -f;
	@find . -name \*.mo -print | xargs rm -f;
	@find . -name \#\*\# -print | xargs rm -f;
312
	@rm -f documentation/config/version.tex
313 314 315
	@if test -e $(PKGNAME); then rm -rf $(PKGNAME); fi
	@if test -e ~/.dvdisaster-original-author; then \
	  mv build.h build.saved ;\
316 317 318 319 320
	  if ! test -x simple-md5sum || ! ./simple-md5sum >/dev/null 2>&1; then \
	    rm -f simple-md5sum; \
	    $(MAKE) --no-print-directory simple-md5sum; \
	    echo "[simple-md5sum (re-)built]"; \
	  fi; \
321
	  ./simple-md5sum -b *.h *.c >fingerprints.md5 ;\
322 323
	  mv build.saved build.h; \
	fi
324
	@rm -f simple-md5sum
325 326
	@$(MAKE) --no-print-directory -C $(SRCDIR)/documentation/codec-specs clean;
	@$(MAKE) --no-print-directory -C $(SRCDIR)/documentation/user-manual clean;
327 328 329

BUILD=`grep BUILD $(SRCDIR)/build.h | cut -d ' ' -f 3`
arch:	archclean time-stamp
330
	@cd .. ; tar -c -z -f $(TAR_PREFIX)/$(PKGNAME)-$(BUILD).tgz $(PKGNAME)
331 332 333 334

INSTALL: documentation/install.template
	@sed "s/@@PKGNAME/$(PKGNAME)/" <documentation/install.template >INSTALL

335 336 337 338 339
srcdist: INSTALL distclean manual manualclean
	@cd .. ; tar -c -j -X $(PKGNAME)/NODIST -f $(TAR_PREFIX)/$(PKGNAME).tar.bz2 $(PKGNAME)
	@cd .. ; gpg --homedir .gnupg --default-key 758BCC23 --detach-sign --output $(TAR_PREFIX)/$(PKGNAME).tar.bz2.gpg --armor $(TAR_PREFIX)/$(PKGNAME).tar.bz2 


340