summaryrefslogtreecommitdiffstats
path: root/libopenbmc_intf/Makefile
blob: 65b1616835d318347f93fa5748c79469c32a5d2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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 gpio_configs.h

LDLIBS+=$(shell pkg-config --libs $(PACKAGE_DEPS)) -lcjson
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 gpio_configs.o gpio_json.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)
OpenPOWER on IntegriCloud