blob: 2f71515622d7a6123f0ab1f9684c49b06eeefe1d [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))
13ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
14
Brad Bishop2afe7182016-08-13 14:08:17 -040015all: $(SONAME) $(BIN)
Brad Bishop62ece2b2016-07-25 09:00:51 -040016
17%.o: %.c
18 $(CC) -c $(ALL_CFLAGS) -o $@ $<
19
20$(SONAME): $(LIBMAPPER)
21 ln -sf $^ $@
22
23$(LIBMAPPER): lib%.so.$(VERSION): %.o
24 $(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(SONAME) \
25 -o $@ $^ $(LDLIBS)
26
Brad Bishop2afe7182016-08-13 14:08:17 -040027$(BIN): app.o $(LIBMAPPER)
28 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
29
30install: $(SONAME) $(LIBMAPPER) $(BIN)
Brad Bishop62ece2b2016-07-25 09:00:51 -040031 @mkdir -p $(DESTDIR)$(includedir)
32 install $(INCLUDES) $(DESTDIR)$(includedir)
33 @mkdir -p $(DESTDIR)$(libdir)
34 install $(LIBMAPPER) $(DESTDIR)$(libdir)
35 ln -sf $(LIBMAPPER) $(DESTDIR)$(libdir)/$(SONAME)
Brad Bishop2afe7182016-08-13 14:08:17 -040036 @mkdir -p $(DESTDIR)$(sbindir)
37 install $(BIN) $(DESTDIR)$(sbindir)
Brad Bishop62ece2b2016-07-25 09:00:51 -040038
39clean:
Brad Bishop2afe7182016-08-13 14:08:17 -040040 rm -f *.o $(LIBMAPPER) $(SONAME) $(BIN)