blob: fe17dc9f7043d598293240ea2e98e1d3a5ee8b06 [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)
Xo Wang3f87de82016-09-22 11:17:01 -07008INCLUDES=openbmc_intf.h openbmc.h gpio.h power_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
Xo Wang3f87de82016-09-22 11:17:01 -070021$(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o power_gpio.o
Brad Bishop489bf652016-06-27 13:10:05 -040022 $(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)