62 lines
1.3 KiB
Makefile
62 lines
1.3 KiB
Makefile
PREFIX = /usr
|
|
CC = gcc
|
|
|
|
PO_SRCS = $(wildcard locale/*/*/*.po)
|
|
PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS))
|
|
PO_DIRS = $(wildcard locale/*/*)
|
|
|
|
SRCS = $(wildcard src/*.c) $(wildcard src/*/*.c)
|
|
OBJS = $(patsubst src/%.c,dist/%.o,$(SRCS))
|
|
HDRS = $(wildcard include/*.h)
|
|
CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
|
|
LIBS = -linih -lmp
|
|
|
|
VERSION = 24.00
|
|
|
|
all: dist dist/mirp $(PO_OUTS)
|
|
|
|
dist:
|
|
mkdir -pv $@
|
|
|
|
dist/mirp: $(OBJS)
|
|
$(CC) -o $@ $^ $(LIBS) $(CFLAGS)
|
|
|
|
dist/%.o: src/%.c
|
|
$(CC) -c -o $@ $^ $(LIBS) $(CFLAGS) -DVERSION=\"${VERSION}\"
|
|
|
|
locale/%.mo: locale/%.po
|
|
msgfmt $^ -o $@
|
|
|
|
locale/%.po: locale/mirp.pot
|
|
cp $@ $@.old
|
|
if msgmerge $@ $^ -o $@ ; then \
|
|
rm $@.old ; \
|
|
echo "merge success: $@" ; \
|
|
else \
|
|
echo "merge failed: $@" ; \
|
|
mv $@.old $@ ; \
|
|
fi; \
|
|
|
|
locale/mirp.pot: $(SRCS)
|
|
mkdir -p locale
|
|
xgettext -k_ -c $^ -o $@
|
|
|
|
install:
|
|
install -Dm755 dist/mirp $(DESTDIR)/$(PREFIX)/bin/mirp
|
|
@for po in $(PO_DIRS) ; do \
|
|
echo "installing locale: $$po/mirp.mo" ; \
|
|
mkdir -pv $(DESTDIR)/$(PREFIX)/share/$$po ; \
|
|
cp $$po/mirp.mo $(DESTDIR)/$(PREFIX)/share/$$po ; \
|
|
done
|
|
|
|
uninstall:
|
|
rm $(DESTDIR)/$(PREFIX)/bin/mirp
|
|
@for po in $(PO_DIRS) ; do \
|
|
rm $(DESTDIR)/$(PREFIX)/share/$$po/mirp.mo ; \
|
|
done
|
|
|
|
format:
|
|
clang-format -i -style=file src/*.c src/*.h
|
|
|
|
.PHONY: install uninstall format
|