forked from logrotate/logrotate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.legacy
189 lines (159 loc) · 4.87 KB
/
Makefile.legacy
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
VERSION = $(shell awk '/Version:/ { print $$2 }' logrotate.spec)
OS_NAME = $(shell uname -s)
LFS = $(shell echo `getconf LFS_CFLAGS 2>/dev/null`)
CFLAGS = -Wall -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" -DHAVE_STRPTIME=1 -DHAVE_QSORT -DHAVE_STRUCT_STAT_ST_BLOCKS -DHAVE_STRUCT_STAT_ST_BLKSIZE -DHAVE_VSYSLOG $(RPM_OPT_FLAGS) $(LFS)
PROG = logrotate
MAN = logrotate.8
MAN5 = logrotate.conf.5
LOADLIBES = -lpopt
SVNURL= svn+ssh://svn.fedorahosted.org/svn/logrotate
SVNPUBURL = http://svn.fedorahosted.org/svn/logrotate
SVNTAG = r$(subst .,-,$(VERSION))
ifeq ($(WITH_SELINUX),yes)
CFLAGS += -DWITH_SELINUX
LOADLIBES += -lselinux
# See pretest
TEST_SELINUX=1
else
# See pretest
TEST_SELINUX=0
endif
ifeq ($(WITH_ACL),yes)
CFLAGS += -DWITH_ACL
LOADLIBES += -lacl
# See pretest
TEST_ACL=1
else
# See pretest
TEST_ACL=0
endif
# HP-UX using GCC
ifeq ($(OS_NAME),HP-UX)
ifeq ($(RPM_OPT_FLAGS),)
RPM_OPT_FLAGS = -O2
endif
CC = gcc
INSTALL = cpset
ifeq ($(POPT_DIR),)
POPT_DIR = /usr/local
endif
ifeq ($(HPLX_DIR),)
HPLX_DIR = /usr/local/hplx
endif
LOADLIBES += -lhplx -L$(HPLX_DIR)/lib
ifeq ($(BASEDIR),)
BASEDIR = /usr/local
endif
endif
# Solaris using gcc
ifeq ($(OS_NAME),SunOS)
CFLAGS = -D_GNU_SOURCE -D$(OS_NAME) -DVERSION=\"$(VERSION)\" $(RPM_OPT_FLAGS) $(LFS)
CC ?= gcc
CPP = $(CC) -E -M
INSTALL = /usr/ucb/install
ifeq ($(CC),cc)
CPP = cc -xM
endif
BASEDIR ?= /usr/local
endif
# Red Hat Linux
ifeq ($(OS_NAME),Linux)
INSTALL = install
BASEDIR = /usr
endif
# FreeBSD
ifeq ($(OS_NAME),FreeBSD)
LOADLIBES += -L${LOCALBASE}/lib
CFLAGS += -I${LOCALBASE}/include
PREFIX=
endif
ifeq ($(OS_NAME),NetBSD)
CFLAGS += -I/usr/include
CFLAGS += -I$(BASEDIR)/include
LOADLIBES += -L/usr/lib
LOADLIBES += -L$(BASEDIR)/lib -Wl,-R,$(BASEDIR)/lib
endif
ifneq ($(POPT_DIR),)
CFLAGS += -I$(POPT_DIR)
LOADLIBES += -L$(POPT_DIR)
endif
ifneq ($(STATEFILE),)
CFLAGS += -DSTATEFILE=\"$(STATEFILE)\"
endif
BINDIR = $(BASEDIR)/sbin
MANDIR ?= $(BASEDIR)/man
#--------------------------------------------------------------------------
OBJS = logrotate.o log.o config.o basenames.o
SOURCES = $(subst .o,.c,$(OBJS) $(LIBOBJS))
ifeq ($(RPM_OPT_FLAGS),)
CFLAGS += -g
LDFLAGS = -g
endif
LDFLAGS += $(EXTRA_LDFLAGS) $(EXTRA_LIBS)
CFLAGS += $(EXTRA_CPPFLAGS) $(EXTRA_CFLAGS)
ifeq (.depend,$(wildcard .depend))
TARGET=$(PROG)
else
TARGET=depend $(PROG)
endif
RCSVERSION = $(subst .,-,$(VERSION))
all: show_warning $(TARGET) pretest
show_warning:
@echo ""
@echo "Building using this Makefile is DEPRECATED."
@echo "Use './autogen.sh', './configure' and 'make' instead."
@echo "Some new features will not be enabled when building using this Makefile."
@echo ""
$(PROG): $(OBJS)
clean:
rm -f $(OBJS) $(PROG) core* .depend
rm -f ./test/test.ACL ./test/test.SELINUX ./test/error.log
depend:
$(CPP) $(CFLAGS) -M $(SOURCES) > .depend
# pretest create the file ./test/test.ACL with
# 0 or 1 according to the WITH_ACL=yes presence.
# The file will be used by ./test/test to decide
# if to do the ACL tests or not.
pretest:
echo "$(TEST_ACL)" > ./test/test.ACL ;
echo "$(TEST_SELINUX)" > ./test/test.SELINUX ;
.PHONY : test
test: $(TARGET)
(cd test; ./test)
install:
[ -d $(PREFIX)$(BINDIR) ] || mkdir -p $(PREFIX)$(BINDIR)
[ -d $(PREFIX)$(MANDIR) ] || mkdir -p $(PREFIX)$(MANDIR)
[ -d $(PREFIX)$(MANDIR)/man8 ] || mkdir -p $(PREFIX)$(MANDIR)/man8
[ -d $(PREFIX)$(MANDIR)/man5 ] || mkdir -p $(PREFIX)$(MANDIR)/man5
if [ "$(OS_NAME)" = HP-UX ]; then \
$(INSTALL) $(PROG) $(PREFIX)$(BINDIR) 0755 bin bin; \
$(INSTALL) $(MAN) $(PREFIX)$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"` 0644 bin bin; \
$(INSTALL) $(MAN5) $(PREFIX)$(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"` 0644 bin bin; \
else if [ "$(OS_NAME)" = FreeBSD ]; then \
$(BSD_INSTALL_PROGRAM) $(PROG) $(BINDIR); \
$(BSD_INSTALL_MAN) $(MAN) $(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \
$(BSD_INSTALL_MAN) $(MAN5) $(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"`/$(MAN5); \
else \
$(INSTALL) -m 755 $(PROG) $(PREFIX)$(BINDIR); \
$(INSTALL) -m 644 $(MAN) $(PREFIX)$(MANDIR)/man`echo $(MAN) | sed "s/.*\.//"`/$(MAN); \
$(INSTALL) -m 644 $(MAN5) $(PREFIX)$(MANDIR)/man`echo $(MAN5) | sed "s/.*\.//"`/$(MAN5); \
fi; fi
co:
co RCS/*,v
(cd examples; co RCS/*,v)
svntag:
svn copy $(SVNURL)/trunk $(SVNURL)/tags/$(SVNTAG) -m "Release $(VERSION)"
create-archive:
@rm -rf /tmp/logrotate-$(VERSION) /tmp/logrotate
@cd /tmp; svn export $(SVNPUBURL)/tags/$(SVNTAG) logrotate-$(VERSION)
@cd /tmp/logrotate-$(VERSION)
@cd /tmp; tar czSpf logrotate-$(VERSION).tar.gz logrotate-$(VERSION)
@rm -rf /tmp/logrotate-$(VERSION)
@cp /tmp/logrotate-$(VERSION).tar.gz .
@rm -f /tmp/logrotate-$(VERSION).tar.gz
@echo " "
@echo "The final archive is ./logrotate-$(VERSION).tar.gz."
archive: clean svntag create-archive
ifeq (.depend,$(wildcard .depend))
include .depend
endif