2024-06-20 00:34:32 +00:00
|
|
|
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 -march=native -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
|
|
|
|
LIBS = -larchive -linih -lgpgme
|
|
|
|
|
|
|
|
VERSION = 24.00
|
|
|
|
|
|
|
|
all: dist/libmp.so $(PO_OUTS)
|
|
|
|
|
2024-06-21 01:42:51 +00:00
|
|
|
dist/libmp.so: $(OBJS)
|
2024-06-20 00:34:32 +00:00
|
|
|
mkdir -p dist
|
|
|
|
$(CC) -shared -o $@ $^ $(LIBS) $(CFLAGS)
|
|
|
|
|
2024-06-21 01:42:51 +00:00
|
|
|
dist/%.o: src/%.c
|
2024-06-26 19:33:20 +00:00
|
|
|
mkdir -p dist/pkg
|
|
|
|
mkdir -p dist/mptp
|
|
|
|
mkdir -p dist/pool
|
2024-06-20 00:34:32 +00:00
|
|
|
$(CC) -c -Wall -fPIC -o $@ $^ $(LIBS) $(CFLAGS) -DVERSION=\"${VERSION}\"
|
|
|
|
|
|
|
|
locale/%.mo: locale/%.po
|
|
|
|
msgfmt $^ -o $@
|
|
|
|
|
|
|
|
locale/%.po: locale/libmp.pot
|
|
|
|
cp $@ $@.old
|
|
|
|
if msgmerge $@ $^ -o $@ ; then \
|
|
|
|
rm $@.old ; \
|
|
|
|
echo "merge success: $@" ; \
|
|
|
|
else \
|
|
|
|
echo "merge failed: $@" ; \
|
|
|
|
mv $@.old $@ ; \
|
|
|
|
fi; \
|
|
|
|
|
|
|
|
locale/libmp.pot: $(SRCS)
|
|
|
|
mkdir -p locale
|
|
|
|
xgettext -k_ -c $^ -o $@
|
|
|
|
|
|
|
|
install:
|
|
|
|
install -m755 dist/libmp.so $(DESTDIR)$(PREFIX)/lib/libmp.so
|
|
|
|
mkdir -pv $(DESTDIR)/usr/include/libmp
|
|
|
|
cp $(HDRS) $(DESTDIR)/usr/include/libmp
|
|
|
|
@for po in $(PO_DIRS) ; do \
|
|
|
|
echo "installing locale: $$po/libmp.mo" ; \
|
|
|
|
mkdir -pv $(DESTDIR)/usr/share/$$po ; \
|
|
|
|
cp $$po/libmp.mo $(DESTDIR)/usr/share/$$po ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm $(DESTDIR)$(PREFIX)/lib/libmp.so
|
|
|
|
rm -r $(DESTDIR)/usr/include/libmp
|
|
|
|
|
|
|
|
format:
|
|
|
|
clang-format -i -style=file src/*.c src/*.c include/*.h examples/*/*.c
|
|
|
|
|
|
|
|
examples:
|
|
|
|
ifeq (,$(wildcard dist/libmp.so))
|
|
|
|
@echo "!!!! you should first compile libmp !!!!"
|
|
|
|
exit 1
|
|
|
|
endif
|
|
|
|
$(MAKE) -C $@
|
|
|
|
|
|
|
|
.PHONY: test install uninstall format examples
|