| 1 |
# Makefile for libipvs |
| 2 |
|
| 3 |
CC = gcc |
| 4 |
CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -fPIC |
| 5 |
ifneq (0,$(HAVE_NL)) |
| 6 |
CFLAGS += -DLIBIPVS_USE_NL |
| 7 |
CFLAGS += $(shell \ |
| 8 |
if which pkg-config > /dev/null 2>&1; then \ |
| 9 |
if pkg-config --cflags libnl-3.0 2> /dev/null; then :; \ |
| 10 |
elif pkg-config --cflags libnl-2.0 2> /dev/null; then :; \ |
| 11 |
elif pkg-config --cflags libnl-1 2> /dev/null; then :; \ |
| 12 |
fi; \ |
| 13 |
fi) |
| 14 |
endif |
| 15 |
|
| 16 |
INCLUDE += $(shell if [ -f ../../ip_vs.h ]; then \ |
| 17 |
echo "-I../../."; fi;) |
| 18 |
DEFINES = $(shell if [ ! -f ../../ip_vs.h ]; then \ |
| 19 |
echo "-DHAVE_NET_IP_VS_H"; fi;) |
| 20 |
DEFINES += $(shell if which pkg-config > /dev/null 2>&1; then \ |
| 21 |
if pkg-config --exists libnl-3.0; then :; \ |
| 22 |
elif pkg-config --exists libnl-2.0; then :; \ |
| 23 |
elif pkg-config --exists libnl-1; \ |
| 24 |
then echo "-DFALLBACK_LIBNL1"; fi; fi) |
| 25 |
|
| 26 |
.PHONY = all clean install dist distclean rpm rpms |
| 27 |
STATIC_LIB = libipvs.a |
| 28 |
SHARED_LIB = libipvs.so |
| 29 |
|
| 30 |
all: $(STATIC_LIB) $(SHARED_LIB) |
| 31 |
|
| 32 |
$(STATIC_LIB): libipvs.o ip_vs_nl_policy.o |
| 33 |
ar rv $@ $^ |
| 34 |
|
| 35 |
$(SHARED_LIB): libipvs.o ip_vs_nl_policy.o |
| 36 |
$(CC) -shared -Wl,-soname,$@ -o $@ $^ |
| 37 |
|
| 38 |
%.o: %.c |
| 39 |
$(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $< |
| 40 |
|
| 41 |
clean: |
| 42 |
rm -f *.[ao] *~ *.orig *.rej core *.so |
| 43 |
|
| 44 |
distclean: clean |