diff --git a/Makefile b/Makefile index 86ccb33..e738d42 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ VERSION = 0.1.2 SUBDIRS = data po src tools RM = rm -f LN = ln -f -TAR = tar -czvf +TAR = tar +MKDIR = mkdir -m 0755 -p all: subdirs @@ -20,7 +21,7 @@ distclean: dist: $(RM) -r -- $(PACKAGE)-$(VERSION) $(LN) -s -- . $(PACKAGE)-$(VERSION) - @$(TAR) $(PACKAGE)-$(VERSION).tar.gz -- \ + @$(TAR) -czvf $(PACKAGE)-$(VERSION).tar.gz -- \ $(PACKAGE)-$(VERSION)/data/Makefile \ $(PACKAGE)-$(VERSION)/data/deforaos-todo.desktop \ $(PACKAGE)-$(VERSION)/data/project.conf \ @@ -59,10 +60,21 @@ dist: $(PACKAGE)-$(VERSION)/project.conf $(RM) -- $(PACKAGE)-$(VERSION) +distcheck: dist + $(TAR) -xzvf $(PACKAGE)-$(VERSION).tar.gz + $(MKDIR) -- $(PACKAGE)-$(VERSION)/objdir + $(MKDIR) -- $(PACKAGE)-$(VERSION)/destdir + (cd "$(PACKAGE)-$(VERSION)" && $(MAKE) OBJDIR="$$PWD/objdir/") + (cd "$(PACKAGE)-$(VERSION)" && $(MAKE) OBJDIR="$$PWD/objdir/" DESTDIR="$$PWD/destdir" install) + (cd "$(PACKAGE)-$(VERSION)" && $(MAKE) OBJDIR="$$PWD/objdir/" DESTDIR="$$PWD/destdir" uninstall) + (cd "$(PACKAGE)-$(VERSION)" && $(MAKE) OBJDIR="$$PWD/objdir/" distclean) + (cd "$(PACKAGE)-$(VERSION)" && $(MAKE) dist) + $(RM) -r -- $(PACKAGE)-$(VERSION) + install: @for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) install) || exit; done uninstall: @for i in $(SUBDIRS); do (cd "$$i" && $(MAKE) uninstall) || exit; done -.PHONY: all subdirs clean distclean dist install uninstall +.PHONY: all subdirs clean distclean dist distcheck install uninstall diff --git a/data/16x16/Makefile b/data/16x16/Makefile index d506063..2e7d099 100644 --- a/data/16x16/Makefile +++ b/data/16x16/Makefile @@ -1,3 +1,4 @@ +OBJDIR = PREFIX = /usr/local DESTDIR = MKDIR = mkdir -m 0755 -p diff --git a/data/24x24/Makefile b/data/24x24/Makefile index a2e5c0b..dc10c93 100644 --- a/data/24x24/Makefile +++ b/data/24x24/Makefile @@ -1,3 +1,4 @@ +OBJDIR = PREFIX = /usr/local DESTDIR = MKDIR = mkdir -m 0755 -p diff --git a/data/48x48/Makefile b/data/48x48/Makefile index 94c72a1..5071c1e 100644 --- a/data/48x48/Makefile +++ b/data/48x48/Makefile @@ -1,3 +1,4 @@ +OBJDIR = PREFIX = /usr/local DESTDIR = MKDIR = mkdir -m 0755 -p diff --git a/data/Makefile b/data/Makefile index 11e1ad4..b0edd40 100644 --- a/data/Makefile +++ b/data/Makefile @@ -1,4 +1,5 @@ SUBDIRS = 16x16 24x24 48x48 +OBJDIR = PREFIX = /usr/local DESTDIR = MKDIR = mkdir -m 0755 -p diff --git a/po/Makefile b/po/Makefile index 6534595..59fa820 100644 --- a/po/Makefile +++ b/po/Makefile @@ -1,4 +1,5 @@ -TARGETS = Todo.pot fr.mo +TARGETS = $(OBJDIR)Todo.pot $(OBJDIR)fr.mo +OBJDIR = PREFIX = /usr/local DESTDIR = RM = rm -f @@ -9,11 +10,11 @@ INSTALL = install all: $(TARGETS) -Todo.pot: POTFILES - ./gettext.sh -P "$(PREFIX)" -- "Todo.pot" +$(OBJDIR)Todo.pot: POTFILES + ./gettext.sh -P "$(PREFIX)" -- "$(OBJDIR)Todo.pot" -fr.mo: Todo.pot fr.po - ./gettext.sh -P "$(PREFIX)" -- "fr.mo" +$(OBJDIR)fr.mo: $(OBJDIR)Todo.pot fr.po + ./gettext.sh -P "$(PREFIX)" -- "$(OBJDIR)fr.mo" clean: $(RM) -- $(Todo.pot_OBJS) $(fr.mo_OBJS) @@ -24,7 +25,7 @@ distclean: clean $(RM) -- $(TARGETS) install: $(TARGETS) - ./gettext.sh -P "$(DESTDIR)$(PREFIX)" -i -- "fr.mo" + ./gettext.sh -P "$(DESTDIR)$(PREFIX)" -i -- "$(OBJDIR)fr.mo" uninstall: ./gettext.sh -P "$(DESTDIR)$(PREFIX)" -u -- "fr.mo" diff --git a/po/gettext.sh b/po/gettext.sh index 11a8805..c3ae919 100755 --- a/po/gettext.sh +++ b/po/gettext.sh @@ -70,9 +70,12 @@ _gettext_mo() { package="$1" lang="$2" + potfile="$3" + pofile="$4" + mofile="$5" - _gettext_po "$package" "$lang" || return 1 - $DEBUG $MSGFMT -c -v -o "$lang.mo" "$lang.po" || return 1 + _gettext_po "$package" "$lang" "$potfile" "$pofile" || return 1 + $DEBUG $MSGFMT -c -v -o "$mofile" "$pofile" || return 1 } @@ -81,11 +84,13 @@ _gettext_po() { package="$1" lang="$2" + potfile="$3" + pofile="$4" - if [ -f "$lang.po" ]; then - $DEBUG $MSGMERGE -U "$lang.po" "$package.pot" || return 1 + if [ -f "$pofile" ]; then + $DEBUG $MSGMERGE -U "$pofile" "$potfile" || return 1 else - $DEBUG $MSGINIT -l "$lang" -o "$lang.po" -i "$package.pot" \ + $DEBUG $MSGINIT -l "$lang" -o "$pofile" -i "$potfile" \ || return 1 fi } @@ -95,8 +100,9 @@ _gettext_po() _gettext_pot() { package="$1" + potfile="$2" - $DEBUG $XGETTEXT -d "$package" -o "$package.pot" --keyword="_" \ + $DEBUG $XGETTEXT -d "$package" -o "$potfile" --keyword="_" \ --keyword="N_" -f "$POTFILES" || return 1 } @@ -142,7 +148,8 @@ fi LOCALEDIR="$PREFIX/share/locale" while [ $# -gt 0 ]; do target="$1" - lang="${target%%.mo}" + source="${target#$OBJDIR}" + lang="${source%%.mo}" lang="${lang%%.po}" shift @@ -168,13 +175,32 @@ while [ $# -gt 0 ]; do #create case "$target" in *.mo) - _gettext_mo "$PACKAGE" "$lang" || exit 2 + #XXX may not match + if [ -n "$OBJDIR" ]; then + potfile="$OBJDIR/$PACKAGE.pot" + else + potfile="$PACKAGE.pot" + fi + mofile="$target" + pofile="${source%%.mo}.po" + _gettext_mo "$PACKAGE" "$lang" "$potfile" "$pofile" \ + "$mofile" || exit 2 ;; *.po) - _gettext_po "$PACKAGE" "$lang" || exit 2 + #XXX may not match + if [ -n "$OBJDIR" ]; then + potfile="$OBJDIR/$PACKAGE.pot" + else + potfile="$PACKAGE.pot" + fi + pofile="$target" + _gettext_po "$PACKAGE" "$lang" "$potfile" "$pofile" \ + || exit 2 ;; *.pot) - _gettext_pot "${target%%.pot}" || exit 2 + package="${source%%.pot}" + potfile="$target" + _gettext_pot "$package" "$potfile" || exit 2 ;; *) exit 2 diff --git a/po/project.conf b/po/project.conf index 11142a1..c6badc5 100644 --- a/po/project.conf +++ b/po/project.conf @@ -10,4 +10,4 @@ depends=POTFILES type=script script=./gettext.sh install= -depends=Todo.pot,fr.po +depends=$(OBJDIR)Todo.pot,fr.po diff --git a/src/Makefile b/src/Makefile index 93724bf..212c1ce 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,5 @@ -TARGETS = todo +TARGETS = $(OBJDIR)todo +OBJDIR = PREFIX = /usr/local DESTDIR = BINDIR = $(PREFIX)/bin @@ -18,27 +19,27 @@ INSTALL = install all: $(TARGETS) -todo_OBJS = task.o taskedit.o todo.o window.o main.o +todo_OBJS = $(OBJDIR)task.o $(OBJDIR)taskedit.o $(OBJDIR)todo.o $(OBJDIR)window.o $(OBJDIR)main.o todo_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) todo_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) -todo: $(todo_OBJS) - $(CC) -o todo $(todo_OBJS) $(todo_LDFLAGS) +$(OBJDIR)todo: $(todo_OBJS) + $(CC) -o $(OBJDIR)todo $(todo_OBJS) $(todo_LDFLAGS) -task.o: task.c task.h - $(CC) $(todo_CFLAGS) -fPIC -c task.c +$(OBJDIR)task.o: task.c task.h + $(CC) $(todo_CFLAGS) -fPIC -o $(OBJDIR)task.o -c task.c -taskedit.o: taskedit.c - $(CC) $(todo_CFLAGS) -fPIC -c taskedit.c +$(OBJDIR)taskedit.o: taskedit.c + $(CC) $(todo_CFLAGS) -fPIC -o $(OBJDIR)taskedit.o -c taskedit.c -todo.o: todo.c task.h todo.h ../config.h - $(CC) $(todo_CFLAGS) -fPIC -c todo.c +$(OBJDIR)todo.o: todo.c task.h todo.h ../config.h + $(CC) $(todo_CFLAGS) -fPIC -o $(OBJDIR)todo.o -c todo.c -window.o: window.c todo.h window.h - $(CC) $(todo_CFLAGS) -c window.c +$(OBJDIR)window.o: window.c todo.h window.h + $(CC) $(todo_CFLAGS) -o $(OBJDIR)window.o -c window.c -main.o: main.c task.h todo.h ../config.h - $(CC) $(todo_CFLAGS) -c main.c +$(OBJDIR)main.o: main.c task.h todo.h ../config.h + $(CC) $(todo_CFLAGS) -o $(OBJDIR)main.o -c main.c clean: $(RM) -- $(todo_OBJS) @@ -48,7 +49,7 @@ distclean: clean install: $(TARGETS) $(MKDIR) $(DESTDIR)$(BINDIR) - $(INSTALL) -m 0755 todo $(DESTDIR)$(BINDIR)/todo + $(INSTALL) -m 0755 $(OBJDIR)todo $(DESTDIR)$(BINDIR)/todo uninstall: $(RM) -- $(DESTDIR)$(BINDIR)/todo diff --git a/tools/Makefile b/tools/Makefile index 7f5298a..afa587f 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,4 +1,5 @@ -TARGETS = todo.so +TARGETS = $(OBJDIR)todo.so +OBJDIR = PREFIX = /usr/local DESTDIR = LIBDIR = $(PREFIX)/lib @@ -19,15 +20,15 @@ INSTALL = install all: $(TARGETS) -todo_OBJS = todo.o +todo_OBJS = $(OBJDIR)todo.o todo_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) todo_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) ../src/task.o ../src/taskedit.o -todo.so: $(todo_OBJS) - $(CCSHARED) -o todo.so $(todo_OBJS) $(todo_LDFLAGS) +$(OBJDIR)todo.so: $(todo_OBJS) + $(CCSHARED) -o $(OBJDIR)todo.so $(todo_OBJS) $(todo_LDFLAGS) -todo.o: todo.c ../src/todo.c - $(CC) $(todo_CFLAGS) -c todo.c +$(OBJDIR)todo.o: todo.c ../src/todo.c + $(CC) $(todo_CFLAGS) -o $(OBJDIR)todo.o -c todo.c clean: $(RM) -- $(todo_OBJS) @@ -37,7 +38,7 @@ distclean: clean install: $(TARGETS) $(MKDIR) $(DESTDIR)$(LIBDIR)/Mailer/plugins - $(INSTALL) -m 0644 todo.so $(DESTDIR)$(LIBDIR)/Mailer/plugins/todo.so + $(INSTALL) -m 0644 $(OBJDIR)todo.so $(DESTDIR)$(LIBDIR)/Mailer/plugins/todo.so uninstall: $(RM) -- $(DESTDIR)$(LIBDIR)/Mailer/plugins/todo.so