~ubuntu-branches/ubuntu/wily/ipvsadm/wily-proposed

« back to all changes in this revision

Viewing changes to .pc/05_addldflags_to_makefile/Makefile

  • Committer: Package Import Robot
  • Author(s): Alexander Wirt
  • Date: 2015-06-23 19:47:16 UTC
  • mfrom: (9.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20150623194716-vyt1qjcvrkny76if
Tags: 1:1.28-3
Upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
#      ipvsadm - IP Virtual Server ADMinistration program
3
 
#                for IPVS NetFilter Module in kernel 2.4
4
 
#
5
 
#      Version: $Id: Makefile 77 2011-02-08 00:23:51Z wensong $
6
 
#
7
 
#      Authors: Wensong Zhang <wensong@linux-vs.org>
8
 
#               Peter Kese <peter.kese@ijs.si>
9
 
#
10
 
#      This file:
11
 
#
12
 
#      ChangeLog
13
 
#
14
 
#      Wensong        :   Modified the Makefile and the spec files so
15
 
#                     :   that rpms can be created with ipvsadm alone
16
 
#      P.Copeland     :   Modified the Makefile and the spec files so
17
 
#                     :   that it is possible to create rpms on the fly
18
 
#                     :   using 'make rpms'
19
 
#                     :   Also added NAME, VERSION and RELEASE numbers to
20
 
#                     :   the Makefile
21
 
#      Horms          :   Updated to add config_stream.c dynamic_array.c
22
 
#                     :   Added autodetection of libpot
23
 
#                     :   Added BUILD_ROOT support
24
 
#      Wensong        :   Changed the OBJS according to detection
25
 
#      Ratz           :   Fixed to use the correct CFLAGS on sparc64
26
 
#
27
 
 
28
 
NAME            = ipvsadm
29
 
VERSION         = $(shell cat VERSION)
30
 
RELEASE         = 1
31
 
SCHEDULERS      = "$(shell cat SCHEDULERS)"
32
 
PE_LIST         = "$(shell cat PERSISTENCE_ENGINES)"
33
 
PROGROOT        = $(shell basename `pwd`)
34
 
ARCH            = $(shell uname -m)
35
 
RPMSOURCEDIR    = $(shell rpm --eval '%_sourcedir')
36
 
RPMSPECDIR      = $(shell rpm --eval '%_specdir')
37
 
 
38
 
CC              = gcc
39
 
INCLUDE         =
40
 
SBIN            = $(BUILD_ROOT)/sbin
41
 
MANDIR          = usr/man
42
 
MAN             = $(BUILD_ROOT)/$(MANDIR)/man8
43
 
INIT            = $(BUILD_ROOT)/etc/rc.d/init.d
44
 
MKDIR           = mkdir
45
 
INSTALL         = install
46
 
STATIC_LIBS     = libipvs/libipvs.a
47
 
 
48
 
ifeq "${ARCH}" "sparc64"
49
 
    CFLAGS = -Wall -Wunused -Wstrict-prototypes -g -m64 -pipe -mcpu=ultrasparc -mcmodel=medlow
50
 
else
51
 
    CFLAGS = -Wall -Wunused -Wstrict-prototypes -g
52
 
endif
53
 
 
54
 
 
55
 
#####################################
56
 
# No servicable parts below this line
57
 
 
58
 
RPMBUILD = $(shell                              \
59
 
        if [ -x /usr/bin/rpmbuild ]; then       \
60
 
                echo "/usr/bin/rpmbuild";       \
61
 
        else                                    \
62
 
                echo "/bin/rpm";                \
63
 
        fi )
64
 
 
65
 
ifeq (,$(FORCE_GETOPT))
66
 
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
67
 
LIB_SEARCH = /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib /usr/lib/$(DEB_HOST_MULTIARCH)
68
 
POPT_LIB = $(shell for i in $(LIB_SEARCH); do \
69
 
  if [ -f $$i/libpopt.a ]; then \
70
 
    if nm $$i/libpopt.a | fgrep -q poptGetContext; then \
71
 
        echo "-lpopt"; \
72
 
        break; \
73
 
    fi; \
74
 
  fi; \
75
 
done)
76
 
endif
77
 
 
78
 
ifneq (,$(POPT_LIB))
79
 
POPT_DEFINE = -DHAVE_POPT
80
 
endif
81
 
 
82
 
OBJS            = ipvsadm.o config_stream.o dynamic_array.o
83
 
LIBS            = $(POPT_LIB)
84
 
ifneq (0,$(HAVE_NL))
85
 
INCLUDE         += $(shell pkg-config --cflags libnl-3.0 libnl-genl-3.0)
86
 
LIBS            += $(shell pkg-config --libs libnl-3.0 libnl-genl-3.0)
87
 
endif
88
 
DEFINES         = -DVERSION=\"$(VERSION)\" -DSCHEDULERS=\"$(SCHEDULERS)\" \
89
 
                  -DPE_LIST=\"$(PE_LIST)\" $(POPT_DEFINE)
90
 
DEFINES         += $(shell if [ ! -f ../ip_vs.h ]; then \
91
 
                     echo "-DHAVE_NET_IP_VS_H"; fi;)
92
 
 
93
 
 
94
 
.PHONY  = all clean install dist distclean rpm rpms
95
 
 
96
 
all:            libs ipvsadm
97
 
 
98
 
libs:
99
 
                make -C libipvs
100
 
 
101
 
ipvsadm:        $(OBJS) $(STATIC_LIBS)
102
 
                $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
103
 
 
104
 
install:        all
105
 
                if [ ! -d $(SBIN) ]; then $(MKDIR) -p $(SBIN); fi
106
 
                $(INSTALL) -m 0755 ipvsadm $(SBIN)
107
 
                $(INSTALL) -m 0755 ipvsadm-save $(SBIN)
108
 
                $(INSTALL) -m 0755 ipvsadm-restore $(SBIN)
109
 
                [ -d $(MAN) ] || $(MKDIR) -p $(MAN)
110
 
                $(INSTALL) -m 0644 ipvsadm.8 $(MAN)
111
 
                $(INSTALL) -m 0644 ipvsadm-save.8 $(MAN)
112
 
                $(INSTALL) -m 0644 ipvsadm-restore.8 $(MAN)
113
 
                [ -d $(INIT) ] || $(MKDIR) -p $(INIT)
114
 
                $(INSTALL) -m 0755 ipvsadm.sh $(INIT)/ipvsadm
115
 
 
116
 
clean:
117
 
                rm -f ipvsadm $(NAME).spec $(NAME)-$(VERSION).tar.gz
118
 
                rm -rf debian/tmp
119
 
                find . -name '*.[ao]' -o -name "*~" -o -name "*.orig" \
120
 
                  -o -name "*.rej" -o -name core | xargs rm -f
121
 
                make -C libipvs clean
122
 
 
123
 
distclean:      clean
124
 
 
125
 
dist:           distclean
126
 
                sed -e "s/@@VERSION@@/$(VERSION)/g" \
127
 
                    -e "s/@@RELEASE@@/$(RELEASE)/g" \
128
 
                    < ipvsadm.spec.in > ipvsadm.spec
129
 
                rm -f $(NAME)-$(VERSION)
130
 
                ln -s . $(NAME)-$(VERSION)
131
 
                tar czvf $(NAME)-$(VERSION).tar.gz                      \
132
 
                    --exclude CVS --exclude .svn --exclude TAGS         \
133
 
                    --exclude $(NAME)-$(VERSION)/$(NAME)-$(VERSION)     \
134
 
                    --exclude $(NAME)-$(VERSION).tar.gz                 \
135
 
                    $(NAME)-$(VERSION)/*
136
 
                rm -f $(NAME)-$(VERSION)
137
 
 
138
 
rpms:           dist
139
 
                cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
140
 
                cp $(NAME).spec $(RPMSPECDIR)/
141
 
                $(RPMBUILD) -ba $(RPMSPECDIR)/$(NAME).spec
142
 
 
143
 
srpm:           dist
144
 
                cp $(NAME)-$(VERSION).tar.gz $(RPMSOURCEDIR)/
145
 
                cp $(NAME).spec $(RPMSPECDIR)/
146
 
                $(RPMBUILD) -bs $(RPMSPECDIR)/$(NAME).spec
147
 
 
148
 
deb:            debs
149
 
 
150
 
debs:
151
 
                dpkg-buildpackage
152
 
 
153
 
%.o:    %.c
154
 
                $(CC) $(CFLAGS) $(INCLUDE) $(DEFINES) -c -o $@ $<