2010-10-13 21:17:51 +02:00
|
|
|
CC?=gcc
|
|
|
|
CFLAGS?=-O2
|
|
|
|
CFLAGS+=-std=gnu99 -Wall -Werror -pedantic -fpic
|
|
|
|
LDFLAGS?=
|
|
|
|
LIBNL=-lnl-tiny
|
|
|
|
PREFIX=/usr
|
|
|
|
INCLUDE_DIR=$(PREFIX)/include/libubox
|
|
|
|
LIBDIR=$(PREFIX)/lib
|
|
|
|
CPPFLAGS=
|
|
|
|
|
2010-12-03 19:16:10 +01:00
|
|
|
OS=$(shell uname)
|
2010-12-05 00:38:58 +01:00
|
|
|
FILES=blob.c blobmsg.c hash.c uhtbl.c usock.c uloop.c
|
2010-12-03 19:16:10 +01:00
|
|
|
ifeq ($(OS),Linux)
|
2010-12-05 00:38:58 +01:00
|
|
|
FILES += unl.c
|
2010-12-04 23:08:26 +01:00
|
|
|
LIBS += $(LIBNL)
|
2010-12-03 19:16:10 +01:00
|
|
|
LDFLAGS_SHARED=-shared -Wl,-soname,$@
|
|
|
|
SHLIB_EXT=so
|
|
|
|
endif
|
|
|
|
ifeq ($(OS),Darwin)
|
|
|
|
LDFLAGS_SHARED=-dynamiclib
|
|
|
|
SHLIB_EXT=dylib
|
|
|
|
endif
|
2010-10-13 21:17:51 +02:00
|
|
|
|
2010-12-03 19:16:10 +01:00
|
|
|
all: libubox.$(SHLIB_EXT)
|
|
|
|
|
|
|
|
libubox.$(SHLIB_EXT): $(FILES)
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LDFLAGS_SHARED)
|
2010-10-13 21:17:51 +02:00
|
|
|
|
|
|
|
install-headers:
|
|
|
|
mkdir -p $(INCLUDE_DIR)
|
|
|
|
cp *.h $(INCLUDE_DIR)/
|
|
|
|
|
|
|
|
install-lib:
|
|
|
|
mkdir -p $(LIBDIR)
|
2010-12-03 19:16:10 +01:00
|
|
|
cp libubox.$(SHLIB_EXT) $(LIBDIR)/
|
2010-10-13 21:17:51 +02:00
|
|
|
|
|
|
|
install: install-lib install-headers
|
|
|
|
|
|
|
|
clean:
|
2010-12-03 19:16:10 +01:00
|
|
|
rm -f *.$(SHLIB_EXT)
|
2010-10-13 21:17:51 +02:00
|
|
|
|