confer/Makefile

67 lines
1.4 KiB
Makefile
Raw Normal View History

2024-08-01 01:48:11 +00:00
SRCS = $(wildcard src/*.c) $(wildcard src/*/*.c)
OBJS = $(patsubst src/%.c,dist/%.o,$(SRCS))
HDRS = $(wildcard src/*.h)
2024-05-01 18:02:15 +00:00
PO_SRCS = $(wildcard locale/*/*/*.po)
PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS))
PO_DIRS = $(wildcard locale/*/*)
2024-08-01 01:48:11 +00:00
CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
LIBS = -linih -lgit2 -lcurl -lcrypto
VERSION = 24.03
PREFIX = /usr
2024-05-01 18:02:15 +00:00
CC = gcc
2024-08-01 01:48:11 +00:00
all: dist dist/confer $(PO_OUTS)
dist:
mkdir -pv dist/cmd
dist/confer: $(OBJS)
$(CC) -o $@ $^ $(LIBS) $(CFLAGS)
2024-05-01 18:02:15 +00:00
2024-08-01 01:48:11 +00:00
dist/%.o: src/%.c
$(CC) -c -o $@ $^ $(LIBS) $(CFLAGS) -DVERSION=\"${VERSION}\"
2024-05-01 18:02:15 +00:00
2024-08-01 01:48:11 +00:00
locale/%.mo: locale/%.po
2024-05-01 18:02:15 +00:00
msgfmt $^ -o $@
2024-08-01 16:31:25 +00:00
locale/%.po: locale/confer.pot
2024-05-01 18:02:15 +00:00
cp $@ $@.old
if msgmerge $@ $^ -o $@ ; then \
rm $@.old ; \
echo "merge success: $@" ; \
else \
echo "merge failed: $@" ; \
mv $@.old $@ ; \
fi; \
2024-08-01 01:48:11 +00:00
locale/confer.pot: $(SRCS)
2024-05-01 18:02:15 +00:00
mkdir -p locale
xgettext -k_ -c $^ -o $@
install:
2024-08-01 01:48:11 +00:00
mkdir -pv $(DESTDIR)/$(PREFIX)/bin
install -v -m755 dist/confer $(DESTDIR)/$(PREFIX)/bin/confer
2024-05-01 18:02:15 +00:00
@for po in $(PO_DIRS) ; do \
echo "installing locale: $$po/mc.mo" ; \
2024-08-01 01:48:11 +00:00
mkdir -pv $(DESTDIR)/$(PREFIX)/share/$$po ; \
cp $$po/mc.mo $(DESTDIR)/$(PREFIX)/share/$$po ; \
2024-05-01 18:02:15 +00:00
done
uninstall:
2024-08-01 01:48:11 +00:00
rm -v $(DESTDIR)/$(PREFIX)/bin/confer
2024-05-01 18:02:15 +00:00
clean:
rm dist/mc
rm locale/mc.pot
@for po in $(PO_DIRS) ; do \
2024-08-01 01:48:11 +00:00
rm $$po/confer.mo ; \
2024-05-01 18:02:15 +00:00
done
format:
2024-08-01 01:48:11 +00:00
clang-format -i -style=file $(HDRS) $(SRCS)
2024-05-01 18:02:15 +00:00
2024-08-01 01:48:11 +00:00
.PHONY: install uninstall clean format