blob: cd8690650f5ba8f15f930af949a6645d8f8d8420 [file] [log] [blame]
Brad Bishop489bf652016-06-27 13:10:05 -04001libdir=/usr/lib
2includedir=/usr/include
3
Brad Bishop40a360c2016-05-28 18:41:04 -04004PACKAGE_DEPS=gio-unix-2.0 glib-2.0
Brad Bishop489bf652016-06-27 13:10:05 -04005SONAME=libopenbmc_intf.so
6VERSION=1
7LIBOBMC=$(SONAME).$(VERSION)
Brad Bishopb408ac02016-06-20 10:00:32 -04008INCLUDES=openbmc_intf.h openbmc.h gpio.h
Brad Bishop40a360c2016-05-28 18:41:04 -04009
Brad Bishop489bf652016-06-27 13:10:05 -040010LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
11ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
Brad Bishop40a360c2016-05-28 18:41:04 -040012
Brad Bishop489bf652016-06-27 13:10:05 -040013all: $(SONAME)
14
15%.o: %.c
16 $(CC) -c $(ALL_CFLAGS) -o $@ $<
17
18$(SONAME): $(LIBOBMC)
19 ln -sf $^ $@
20
21$(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o
22 $(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(SONAME) \
23 -o $@ $^ $(LDLIBS)
24
25install: $(SONAME) $(LIBOBMC)
Brad Bishopb408ac02016-06-20 10:00:32 -040026 @mkdir -p $(DESTDIR)$(includedir)
27 install $(INCLUDES) $(DESTDIR)$(includedir)
Brad Bishop40a360c2016-05-28 18:41:04 -040028 @mkdir -p $(DESTDIR)$(libdir)
Brad Bishop489bf652016-06-27 13:10:05 -040029 install $(LIBOBMC) $(DESTDIR)$(libdir)
30 ln -sf $(LIBOBMC) $(DESTDIR)$(libdir)/$(SONAME)
Brad Bishop40a360c2016-05-28 18:41:04 -040031
Brad Bishop489bf652016-06-27 13:10:05 -040032clean:
33 rm -f *.o $(LIBOBMC) $(SONAME)