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) |
Lei YU | 45cb4fc | 2016-11-29 01:48:26 +0800 | [diff] [blame] | 8 | INCLUDES=openbmc_intf.h openbmc.h gpio.h gpio_configs.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 | |
Lei YU | 45cb4fc | 2016-11-29 01:48:26 +0800 | [diff] [blame] | 21 | $(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o gpio_configs.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) |