Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 1 | libdir=/usr/lib |
| 2 | includedir=/usr/include |
| 3 | |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 4 | PACKAGE_DEPS=gio-unix-2.0 glib-2.0 |
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 5 | SONAME=libopenbmc_intf.so |
| 6 | VERSION=1 |
| 7 | LIBOBMC=$(SONAME).$(VERSION) |
Xo Wang | 3f87de8 | 2016-09-22 11:17:01 -0700 | [diff] [blame^] | 8 | INCLUDES=openbmc_intf.h openbmc.h gpio.h power_gpio.h |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 9 | |
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 10 | LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS)) |
| 11 | ALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS) |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 12 | |
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 13 | all: $(SONAME) |
| 14 | |
| 15 | %.o: %.c |
| 16 | $(CC) -c $(ALL_CFLAGS) -o $@ $< |
| 17 | |
| 18 | $(SONAME): $(LIBOBMC) |
| 19 | ln -sf $^ $@ |
| 20 | |
Xo Wang | 3f87de8 | 2016-09-22 11:17:01 -0700 | [diff] [blame^] | 21 | $(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o power_gpio.o |
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 22 | $(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(SONAME) \ |
| 23 | -o $@ $^ $(LDLIBS) |
| 24 | |
| 25 | install: $(SONAME) $(LIBOBMC) |
Brad Bishop | b408ac0 | 2016-06-20 10:00:32 -0400 | [diff] [blame] | 26 | @mkdir -p $(DESTDIR)$(includedir) |
| 27 | install $(INCLUDES) $(DESTDIR)$(includedir) |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 28 | @mkdir -p $(DESTDIR)$(libdir) |
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 29 | install $(LIBOBMC) $(DESTDIR)$(libdir) |
| 30 | ln -sf $(LIBOBMC) $(DESTDIR)$(libdir)/$(SONAME) |
Brad Bishop | 40a360c | 2016-05-28 18:41:04 -0400 | [diff] [blame] | 31 | |
Brad Bishop | 489bf65 | 2016-06-27 13:10:05 -0400 | [diff] [blame] | 32 | clean: |
| 33 | rm -f *.o $(LIBOBMC) $(SONAME) |