xref: /openbmc/skeleton/libopenbmc_intf/Makefile (revision ea3d8a4169894cbc3fddcac05c8a14ffffabc602)
1489bf656SBrad Bishoplibdir=/usr/lib
2489bf656SBrad Bishopincludedir=/usr/include
3489bf656SBrad Bishop
440a360c2SBrad BishopPACKAGE_DEPS=gio-unix-2.0 glib-2.0
5489bf656SBrad BishopSONAME=libopenbmc_intf.so
6489bf656SBrad BishopVERSION=1
7489bf656SBrad BishopLIBOBMC=$(SONAME).$(VERSION)
845cb4fccSLei YUINCLUDES=openbmc_intf.h openbmc.h gpio.h gpio_configs.h
940a360c2SBrad Bishop
10*ea3d8a41SMatt SpinlerLDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS)) -lcjson
11489bf656SBrad BishopALL_CFLAGS+=$(shell pkg-config --cflags $(PACKAGE_DEPS)) -fPIC -Werror $(CFLAGS)
1240a360c2SBrad Bishop
13489bf656SBrad Bishopall: $(SONAME)
14489bf656SBrad Bishop
15489bf656SBrad Bishop%.o: %.c
16489bf656SBrad Bishop	$(CC) -c $(ALL_CFLAGS) -o $@ $<
17489bf656SBrad Bishop
18489bf656SBrad Bishop$(SONAME): $(LIBOBMC)
19489bf656SBrad Bishop	ln -sf $^ $@
20489bf656SBrad Bishop
21*ea3d8a41SMatt Spinler$(LIBOBMC): lib%.so.$(VERSION): %.o gpio.o gpio_configs.o gpio_json.o
22489bf656SBrad Bishop	$(CC) -shared $(CFLAGS) $(LDFLAGS) -Wl,-soname,$(SONAME) \
23489bf656SBrad Bishop		-o $@ $^ $(LDLIBS)
24489bf656SBrad Bishop
25489bf656SBrad Bishopinstall: $(SONAME) $(LIBOBMC)
26b408ac0dSBrad Bishop	@mkdir -p $(DESTDIR)$(includedir)
27b408ac0dSBrad Bishop	install $(INCLUDES) $(DESTDIR)$(includedir)
2840a360c2SBrad Bishop	@mkdir -p $(DESTDIR)$(libdir)
29489bf656SBrad Bishop	install $(LIBOBMC) $(DESTDIR)$(libdir)
30489bf656SBrad Bishop	ln -sf $(LIBOBMC) $(DESTDIR)$(libdir)/$(SONAME)
3140a360c2SBrad Bishop
32489bf656SBrad Bishopclean:
33489bf656SBrad Bishop	rm -f *.o $(LIBOBMC) $(SONAME)
34