Hi,

The attached patch modifiy the Makefiles to build (from sources .po to
binaries .mo, with msgfmt) and installs (in
/usr/share/locale/*/LC_MESSAGES/powerpot.mo) the translations files in po/. 
It also gzip and install the manpage.

Notes :
- The patch create a new po/Makefile file, so it must be applied with "patch
  -p0" (without "-p0" everything ends up in main ./Makefile), and be svn added.
- The install path LOCALESDIR is an overridable make variable, but for now only
  the default path will work (/usr/share/locale/ is hardcoded in powertop.c).

 
Index: Makefile
===================================================================
--- Makefile    (révision 76)
+++ Makefile    (copie de travail)
@@ -1,14 +1,25 @@
 BINDIR=/usr/bin
+LOCALESDIR=/usr/share/locale
+MANDIR=/usr/share/man/man1
 WARNFLAGS=-Wall
 CFLAGS?=-O2 -g ${WARNFLAGS}
 CC?=gcc
 
 powertop: powertop.c config.c process.c misctips.c bluetooth.c display.c 
Makefile powertop.h
        $(CC) ${CFLAGS}  powertop.c config.c process.c misctips.c bluetooth.c 
display.c -lncurses -o powertop
+       @(cd po/ && $(MAKE))
 
-install: powertop
+powertop.1.gz: powertop.1
+       gzip -c $< > $@
+
+install: powertop powertop.1.gz
        mkdir -p ${DESTDIR}${BINDIR}
        cp powertop ${DESTDIR}${BINDIR}
-       
+       mkdir -p ${DESTDIR}${MANDIR}
+       cp powertop.1.gz ${DESTDIR}${MANDIR}
+       @(cd po/ && env LOCALESDIR=$(LOCALESDIR) DESTDIR=$(DESTDIR) $(MAKE) $@)
+
 clean:
-       rm -f *~ powertop
+       rm -f *~ powertop powertop.1.gz
+       @(cd po/ && $(MAKE) $@)
+

Index: po/Makefile
===================================================================
--- po/Makefile (révision 0)
+++ po/Makefile (révision 0)
@@ -0,0 +1,20 @@
+SRC=$(wildcard *.po)
+OBJ= $(SRC:.po=.mo)
+INST= $(SRC:.po=.inst)
+
+translations: $(OBJ)
+       
+%.mo: %.po
+       [EMAIL PROTECTED] -o $@ -v $<
+
+clean:
+       rm -f *.mo
+
+# hack to automate installation dynamicaly, without previous knowledge of 
+# the po/mo file list (we fool make by pretending the need for .inst files).
+install: $(OBJ) $(INST)
+
+%.inst: %.mo
+       mkdir -p $(DESTDIR)$(LOCALESDIR)/$*/LC_MESSAGES/
+       cp -f $< $(DESTDIR)$(LOCALESDIR)/$*/LC_MESSAGES/powertop.mo
+
_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to