57 lines
1.2 KiB
Makefile
57 lines
1.2 KiB
Makefile
HEADERS = $(wildcard src/*.h)
|
|
CSRCS = $(wildcard src/*.c)
|
|
|
|
PO_SRCS = $(wildcard locale/*/*/*.po)
|
|
PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS))
|
|
PO_DIRS = $(wildcard locale/*/*)
|
|
|
|
prefix = /usr
|
|
CC = gcc
|
|
|
|
all: dist/xcfg $(PO_OUTS)
|
|
|
|
dist/xcfg: $(CSRCS) $(HEADERS)
|
|
mkdir -p dist
|
|
$(CC) $(CFLAGS) $(CSRCS) -o $@ -lncurses -lmenu -lm
|
|
|
|
locale/%.mo: locale/%.po
|
|
msgfmt $^ -o $@
|
|
|
|
locale/%.po: locale/xcfg.pot
|
|
cp $@ $@.old
|
|
if msgmerge $@ $^ -o $@ ; then \
|
|
rm $@.old ; \
|
|
echo "merge success: $@" ; \
|
|
else \
|
|
echo "merge failed: $@" ; \
|
|
install -m644 $@.old $@ ; \
|
|
fi; \
|
|
|
|
locale/xcfg.pot: $(CSRCS)
|
|
mkdir -p locale
|
|
xgettext -k_ -c $^ -o $@
|
|
|
|
install:
|
|
mkdir -pv $(DESTDIR)/$(prefix)/bin
|
|
install -v -m755 dist/xcfg $(DESTDIR)/$(prefix)/bin/xcfg
|
|
@for po in $(PO_DIRS) ; do \
|
|
echo "installing locale: $$po/xcfg.mo" ; \
|
|
install -v -Ddm755 $(DESTDIR)/usr/share/$$po ; \
|
|
install -m644 $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
|
|
done
|
|
|
|
uninstall:
|
|
rm -v $(DESTDIR)/$(prefix)/bin/xcfg
|
|
|
|
clean:
|
|
rm -v dist/xcfg
|
|
rm -v locale/xcfg.pot
|
|
@for po in $(PO_DIRS) ; do \
|
|
rm $$po/xcfg.mo ; \
|
|
done
|
|
|
|
format:
|
|
clang-format -i -style=file $(HEADERS) $(CSRCS)
|
|
|
|
.PHONY: install uninstall clean
|