BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
-SRC := $(wildcard *.c) $(wildcard *.cpp)
+SRC := ldid.cpp
LIBS ?= -lcrypto -lplist-2.0
-all: ldid
+MANPAGE_LANGS := zh_TW zh_CN
-%.c.o: %.c
- $(CC) -c $(CFLAGS) $(CPPFLAGS) -I. $< -o $@
+all: ldid
%.cpp.o: %.cpp
$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -I. -DLDID_VERSION=\"$(VERSION)\" $< -o $@
$(CXX) $(CXXFLAGS) -o ldid $^ $(LDFLAGS) $(LIBS)
install: all
- $(INSTALL) -D -m755 ldid $(DESTDIR)$(BINDIR)/ldid
+ $(INSTALL) -d $(DESTDIR)$(BINDIR)/
+ $(INSTALL) -m755 ldid $(DESTDIR)$(BINDIR)/ldid
$(LN) -sf ldid $(DESTDIR)$(BINDIR)/ldid2
- $(INSTALL) -D -m644 docs/ldid.1 $(DESTDIR)$(MANDIR)/man1/ldid.1
- $(INSTALL) -D -m644 docs/ldid.1.zh_TW $(DESTDIR)$(MANDIR)/zh_TW/man1/ldid.1
+ $(INSTALL) -d $(DESTDIR)$(MANDIR)/man1/
+ $(INSTALL) -m644 docs/ldid.1 $(DESTDIR)$(MANDIR)/man1/ldid.1
+ for lang in $(MANPAGE_LANGS); do \
+ $(INSTALL) -d $(DESTDIR)$(MANDIR)/$$lang/man1/; \
+ $(INSTALL) -m644 docs/ldid.$$lang.1 $(DESTDIR)$(MANDIR)/$$lang/man1/ldid.1; \
+ done
clean:
rm -rf ldid *.o