2024-02-20 18:12:54 +00:00
|
|
|
HEADERS = $(wildcard src/*.h)
|
2024-05-01 10:07:40 +00:00
|
|
|
CSRCS = $(wildcard src/*.c)
|
2024-04-22 23:28:22 +00:00
|
|
|
|
2024-05-01 10:07:40 +00:00
|
|
|
PO_SRCS = $(wildcard locale/*/*/*.po)
|
|
|
|
PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS))
|
|
|
|
PO_DIRS = $(wildcard locale/*/*)
|
2024-02-20 18:12:54 +00:00
|
|
|
|
2024-05-01 10:07:40 +00:00
|
|
|
prefix = /usr
|
|
|
|
CC = gcc
|
2024-04-22 23:28:22 +00:00
|
|
|
|
2024-05-01 10:07:40 +00:00
|
|
|
all: dist/xcfg $(PO_OUTS)
|
|
|
|
|
|
|
|
dist/xcfg: $(CSRCS) $(HEADERS)
|
2024-02-20 18:12:54 +00:00
|
|
|
mkdir -p dist
|
2024-05-01 10:07:40 +00:00
|
|
|
$(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: $@" ; \
|
|
|
|
mv $@.old $@ ; \
|
|
|
|
fi; \
|
|
|
|
|
|
|
|
locale/xcfg.pot: $(CSRCS)
|
2024-02-20 18:12:54 +00:00
|
|
|
mkdir -p locale
|
2024-05-01 10:07:40 +00:00
|
|
|
xgettext -k_ -c $^ -o $@
|
2024-02-20 18:12:54 +00:00
|
|
|
|
|
|
|
install:
|
2024-05-01 10:07:40 +00:00
|
|
|
mkdir -pv $(DESTDIR)$(prefix)/bin
|
|
|
|
install -v -m755 dist/xcfg $(DESTDIR)$(prefix)/bin/xcfg
|
2024-02-20 18:12:54 +00:00
|
|
|
@for po in $(PO_DIRS) ; do \
|
2024-02-22 17:31:10 +00:00
|
|
|
echo "installing locale: $$po/xcfg.mo" ; \
|
2024-02-20 18:12:54 +00:00
|
|
|
mkdir -pv $(DESTDIR)/usr/share/$$po ; \
|
2024-02-22 17:31:10 +00:00
|
|
|
cp $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
|
2024-02-20 18:12:54 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
uninstall:
|
2024-05-01 10:07:40 +00:00
|
|
|
rm -v $(DESTDIR)$(prefix)/bin/xcfg
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm dist/xcfg
|
|
|
|
rm locale/xcfg.pot
|
|
|
|
@for po in $(PO_DIRS) ; do \
|
|
|
|
rm $$po/xcfg.mo ; \
|
|
|
|
done
|
2024-02-20 18:12:54 +00:00
|
|
|
|
2024-04-22 23:28:22 +00:00
|
|
|
format:
|
2024-05-01 10:07:40 +00:00
|
|
|
clang-format -i -style=file $(HEADERS) $(CSRCS)
|
2024-04-22 23:28:22 +00:00
|
|
|
|
2024-05-01 10:07:40 +00:00
|
|
|
.PHONY: install defcfg uninstall clean
|