blob: fe17dc9f7043d598293240ea2e98e1d3a5ee8b06 [file] [log] [blame]
libdir=/usr/lib
includedir=/usr/include
PACKAGE_DEPS=gio-unix-2.0 glib-2.0
SONAME=libopenbmc_intf.so
VERSION=1
LIBOBMC=$(SONAME).$(VERSION)
INCLUDES=openbmc_intf.h openbmc.h gpio.h power_gpio.h
LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS))
ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
all: $(SONAME)
%.o: %.c
$(CC) -c $(ALL_CFLAGS) -o $@ $<
$(SONAME): $(LIBOBMC)
ln -sf $^ $@
$(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o power_gpio.o
$(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(SONAME) \
-o $@ $^ $(LDLIBS)
install: $(SONAME) $(LIBOBMC)
@mkdir -p $(DESTDIR)$(includedir)
install $(INCLUDES) $(DESTDIR)$(includedir)
@mkdir -p $(DESTDIR)$(libdir)
install $(LIBOBMC) $(DESTDIR)$(libdir)
ln -sf $(LIBOBMC) $(DESTDIR)$(libdir)/$(SONAME)
clean:
rm -f *.o $(LIBOBMC) $(SONAME)