blob: df6ccf008243caf3394ef4bf74e13e0ff38db697 [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)
Lei YU45cb4fc2016-11-29 01:48:26 +08008INCLUDES=openbmc_intf.h openbmc.h gpio.h gpio_configs.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
Lei YU45cb4fc2016-11-29 01:48:26 +080021$(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o gpio_configs.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)