xcfg/Makefile

62 lines
1.3 KiB
Makefile
Raw Normal View History

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-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-08-15 01:34:14 +00:00
CFLAGS = -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
LIBS = -lncurses -lmenu -lm
2024-05-01 10:07:40 +00:00
prefix = /usr
CC = gcc
2024-08-15 01:34:14 +00:00
VERSION = 24.08
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-08-15 01:34:14 +00:00
$(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" $(CSRCS) -o $@ $(LIBS)
2024-05-01 10:07:40 +00:00
2024-08-15 01:17:49 +00:00
locale/%.mo: locale/%.po
2024-05-01 10:07:40 +00:00
msgfmt $^ -o $@
locale/%.po: locale/xcfg.pot
cp $@ $@.old
if msgmerge $@ $^ -o $@ ; then \
rm $@.old ; \
echo "merge success: $@" ; \
else \
echo "merge failed: $@" ; \
2024-08-15 01:17:49 +00:00
install -m644 $@.old $@ ; \
2024-05-01 10:07:40 +00:00
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-08-15 01:17:49 +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 \
echo "installing locale: $$po/xcfg.mo" ; \
2024-08-15 01:17:49 +00:00
install -v -Ddm755 $(DESTDIR)/usr/share/$$po ; \
install -m644 $$po/xcfg.mo $(DESTDIR)/usr/share/$$po ; \
2024-02-20 18:12:54 +00:00
done
uninstall:
2024-08-15 01:17:49 +00:00
rm -v $(DESTDIR)/$(prefix)/bin/xcfg
2024-05-01 10:07:40 +00:00
clean:
2024-08-15 01:17:49 +00:00
rm -v dist/xcfg
rm -v locale/xcfg.pot
2024-05-01 10:07:40 +00:00
@for po in $(PO_DIRS) ; do \
rm $$po/xcfg.mo ; \
done
2024-02-20 18:12:54 +00:00
format:
2024-08-15 01:17:49 +00:00
clang-format -i -style=file $(HEADERS) $(CSRCS)
2024-08-15 01:17:49 +00:00
.PHONY: install uninstall clean