SRCS = $(wildcard src/*.c) $(wildcard src/*/*.c) OBJS = $(patsubst src/%.c,dist/%.o,$(SRCS)) HDRS = $(wildcard src/*.h) PO_SRCS = $(wildcard locale/*/*/*.po) PO_OUTS = $(patsubst locale/%.po,locale/%.mo,$(PO_SRCS)) PO_DIRS = $(wildcard locale/*/*) CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection LIBS = -linih -lgit2 -lcurl -lcrypto VERSION = 24.03 PREFIX = /usr CC = gcc all: dist dist/confer $(PO_OUTS) dist: mkdir -pv dist/cmd dist/confer: $(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/confer.pot cp $@ $@.old if msgmerge $@ $^ -o $@ ; then \ rm $@.old ; \ echo "merge success: $@" ; \ else \ echo "merge failed: $@" ; \ mv $@.old $@ ; \ fi; \ locale/confer.pot: $(SRCS) mkdir -p locale xgettext -k_ -c $^ -o $@ install: mkdir -pv $(DESTDIR)/$(PREFIX)/bin install -v -m755 dist/confer $(DESTDIR)/$(PREFIX)/bin/confer @for po in $(PO_DIRS) ; do \ echo "installing locale: $$po/confer.mo" ; \ mkdir -pv $(DESTDIR)/$(PREFIX)/share/$$po ; \ cp $$po/confer.mo $(DESTDIR)/$(PREFIX)/share/$$po ; \ done uninstall: rm -v $(DESTDIR)/$(PREFIX)/bin/confer clean: rm dist/confer rm locale/confer.pot @for po in $(PO_DIRS) ; do \ rm $$po/confer.mo ; \ done format: clang-format -i -style=file $(HDRS) $(SRCS) .PHONY: install uninstall clean format