blob: 128a032bf418093b09a552e6e964684f1731c032 [file] [log] [blame]
Brad Bishop62ece2b2016-07-25 09:00:51 -04001libdir=/usr/lib
Brad Bishop2afe7182016-08-13 14:08:17 -04002sbindir=/usr/sbin
Brad Bishop62ece2b2016-07-25 09:00:51 -04003includedir=/usr/include
4
5PACKAGE_DEPS=libsystemd
6SONAME=libmapper.so
7VERSION=1
8LIBMAPPER=$(SONAME).$(VERSION)
Brad Bishop2afe7182016-08-13 14:08:17 -04009BIN=mapper
Brad Bishop62ece2b2016-07-25 09:00:51 -040010INCLUDES=mapper.h
11
12LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
Matthew Barthf2b894e2016-08-18 14:45:34 -050013ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) \
14 -fPIC -Wall -Werror $(CFLAGS)
Brad Bishop62ece2b2016-07-25 09:00:51 -040015
Brad Bishop2afe7182016-08-13 14:08:17 -040016all: $(SONAME) $(BIN)
Brad Bishop62ece2b2016-07-25 09:00:51 -040017
18%.o: %.c
19 $(CC) -c $(ALL_CFLAGS) -o $@ $<
20
21$(SONAME): $(LIBMAPPER)
22 ln -sf $^ $@
23
24$(LIBMAPPER): lib%.so.$(VERSION): %.o
25 $(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(SONAME) \
26 -o $@ $^ $(LDLIBS)
27
Brad Bishop2afe7182016-08-13 14:08:17 -040028$(BIN): app.o $(LIBMAPPER)
29 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
30
31install: $(SONAME) $(LIBMAPPER) $(BIN)
Brad Bishop62ece2b2016-07-25 09:00:51 -040032 @mkdir -p $(DESTDIR)$(includedir)
33 install $(INCLUDES) $(DESTDIR)$(includedir)
34 @mkdir -p $(DESTDIR)$(libdir)
35 install $(LIBMAPPER) $(DESTDIR)$(libdir)
36 ln -sf $(LIBMAPPER) $(DESTDIR)$(libdir)/$(SONAME)
Brad Bishop2afe7182016-08-13 14:08:17 -040037 @mkdir -p $(DESTDIR)$(sbindir)
38 install $(BIN) $(DESTDIR)$(sbindir)
Brad Bishop62ece2b2016-07-25 09:00:51 -040039
40clean:
Brad Bishop2afe7182016-08-13 14:08:17 -040041 rm -f *.o $(LIBMAPPER) $(SONAME) $(BIN)