Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From 58292175115bae7a4c3600d3022e59ea57213025 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jianchuan Wang <jianchuan.wang@windriver.com> |
| 3 | Date: Mon, 12 Jan 2015 15:53:23 +0800 |
| 4 | Subject: [PATCH] Modify the Makefile for cross compile. |
| 5 | |
| 6 | Upstream-Status: Inappropriate [embedded specific] |
| 7 | |
| 8 | Signed-off-by: Jianchuan Wang <jianchuan.wang@windriver.com> |
| 9 | --- |
| 10 | Makefile | 23 ++++++----------------- |
| 11 | libipvs/Makefile | 3 +-- |
| 12 | 2 files changed, 7 insertions(+), 19 deletions(-) |
| 13 | |
| 14 | diff --git a/Makefile b/Makefile |
| 15 | index e4e03cc..461c021 100644 |
| 16 | --- a/Makefile |
| 17 | +++ b/Makefile |
| 18 | @@ -35,10 +35,9 @@ ARCH = $(shell uname -m) |
| 19 | RPMSOURCEDIR = $(shell rpm --eval '%_sourcedir') |
| 20 | RPMSPECDIR = $(shell rpm --eval '%_specdir') |
| 21 | |
| 22 | -CC = gcc |
| 23 | INCLUDE = |
| 24 | SBIN = $(BUILD_ROOT)/sbin |
| 25 | -MANDIR = usr/man |
| 26 | +MANDIR = usr/share/man |
| 27 | MAN = $(BUILD_ROOT)/$(MANDIR)/man8 |
| 28 | INIT = $(BUILD_ROOT)/etc/rc.d/init.d |
| 29 | MKDIR = mkdir |
| 30 | @@ -62,17 +61,7 @@ RPMBUILD = $(shell \ |
| 31 | echo "/bin/rpm"; \ |
| 32 | fi ) |
| 33 | |
| 34 | -ifeq (,$(FORCE_GETOPT)) |
| 35 | -LIB_SEARCH = /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib |
| 36 | -POPT_LIB = $(shell for i in $(LIB_SEARCH); do \ |
| 37 | - if [ -f $$i/libpopt.a ]; then \ |
| 38 | - if nm $$i/libpopt.a | fgrep -q poptGetContext; then \ |
| 39 | - echo "-lpopt"; \ |
| 40 | - break; \ |
| 41 | - fi; \ |
| 42 | - fi; \ |
| 43 | -done) |
| 44 | -endif |
| 45 | +POPT_LIB = -lpopt |
| 46 | |
| 47 | ifneq (,$(POPT_LIB)) |
| 48 | POPT_DEFINE = -DHAVE_POPT |
| 49 | @@ -81,7 +70,7 @@ endif |
| 50 | OBJS = ipvsadm.o config_stream.o dynamic_array.o |
| 51 | LIBS = $(POPT_LIB) |
| 52 | ifneq (0,$(HAVE_NL)) |
| 53 | -LIBS += -lnl |
| 54 | +LIBS += -lnl-3 -lnl-genl-3 |
| 55 | endif |
| 56 | DEFINES = -DVERSION=\"$(VERSION)\" -DSCHEDULERS=\"$(SCHEDULERS)\" \ |
| 57 | -DPE_LIST=\"$(PE_LIST)\" $(POPT_DEFINE) |
| 58 | @@ -91,13 +80,13 @@ DEFINES += $(shell if [ ! -f ../ip_vs.h ]; then \ |
| 59 | |
| 60 | .PHONY = all clean install dist distclean rpm rpms |
| 61 | |
| 62 | -all: libs ipvsadm |
| 63 | +all: ipvsadm |
| 64 | |
| 65 | libs: |
| 66 | make -C libipvs |
| 67 | |
| 68 | -ipvsadm: $(OBJS) $(STATIC_LIBS) |
| 69 | - $(CC) $(CFLAGS) -o $@ $^ $(LIBS) |
| 70 | +ipvsadm: $(OBJS) libs |
| 71 | + $(CC) $(CFLAGS) -o $@ $(OBJS) $(STATIC_LIBS) $(LIBS) |
| 72 | |
| 73 | install: all |
| 74 | if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi |
| 75 | diff --git a/libipvs/Makefile b/libipvs/Makefile |
| 76 | index a527a7f..b7300ec 100644 |
| 77 | --- a/libipvs/Makefile |
| 78 | +++ b/libipvs/Makefile |
| 79 | @@ -1,6 +1,5 @@ |
| 80 | # Makefile for libipvs |
| 81 | |
| 82 | -CC = gcc |
| 83 | CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -fPIC |
| 84 | ifneq (0,$(HAVE_NL)) |
| 85 | CFLAGS += -DLIBIPVS_USE_NL |
| 86 | @@ -18,7 +17,7 @@ SHARED_LIB = libipvs.so |
| 87 | all: $(STATIC_LIB) $(SHARED_LIB) |
| 88 | |
| 89 | $(STATIC_LIB): libipvs.o ip_vs_nl_policy.o |
| 90 | - ar rv $@ $^ |
| 91 | + $(AR) rv $@ $^ |
| 92 | |
| 93 | $(SHARED_LIB): libipvs.o ip_vs_nl_policy.o |
| 94 | $(CC) -shared -Wl,-soname,$@ -o $@ $^ |
| 95 | -- |
| 96 | 1.9.1 |
| 97 | |