61 lines
1.4 KiB
Makefile
61 lines
1.4 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/pooler $(PO_OUTS)
|
|
|
|
dist:
|
|
mkdir -pv $@
|
|
|
|
dist/pooler: $(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/pooler.pot
|
|
cp $@ $@.old
|
|
if msgmerge $@ $^ -o $@ ; then \
|
|
rm $@.old ; \
|
|
echo "merge success: $@" ; \
|
|
else \
|
|
echo "merge failed: $@" ; \
|
|
mv $@.old $@ ; \
|
|
fi; \
|
|
|
|
locale/pooler.pot: $(SRCS)
|
|
mkdir -p locale
|
|
xgettext -k_ -c $^ -o $@
|
|
|
|
install:
|
|
install -d -m700 $(DESTDIR)/etc/pooler
|
|
install -m755 dist/pooler $(DESTDIR)/$(PREFIX)/bin/pooler
|
|
install -m600 install/config.ini $(DESTDIR)/etc/pooler/config.ini
|
|
@for po in $(PO_DIRS) ; do \
|
|
echo "installing locale: $$po/pooler.mo" ; \
|
|
mkdir -pv $(DESTDIR)/$(PREFIX)/share/$$po ; \
|
|
cp $$po/pooler.mo $(DESTDIR)/$(PREFIX)/share/$$po ; \
|
|
done
|
|
|
|
uninstall:
|
|
rm $(DESTDIR)/$(PREFIX)/bin/pooler
|
|
|
|
format:
|
|
clang-format -i -style=file src/*.c src/*.h
|
|
|
|
.PHONY: install uninstall format
|