forked from gregkh/smugbatch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
133 lines (105 loc) · 3.51 KB
/
Makefile
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
#
# Copyright (C) 2006 Greg Kroah-Hartman <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
VERSION = 006
PROGRAM = smugup smugls smugdown
CORE_OBJS = \
smug_core.o \
md5.o
SMUG_OBJS = \
smug_core.o \
smugup.o \
smugls.o \
smugdown.o \
md5.o
HEADERS = \
smug.h \
GEN_HEADERS = \
smugbatch_version.h
MAN_PAGES = \
smugup.1 \
smugls.1
CROSS_COMPILE ?=
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
override CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -O2
WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \
-Wchar-subscripts -Wmissing-declarations -Wnested-externs \
-Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes
CFLAGS += $(WARNINGS)
LDFLAGS += -Wl,-warn-common,--as-needed
ifeq ($(strip $(V)),)
E = @echo
Q = @
else
E = @\#
Q =
endif
export E Q
# We need -lcurl for the curl stuff
# We need -lsocket and -lnsl when on Solaris
# We need -lssl and -lcrypto when using libcurl with SSL support
# We need -lpthread for the pthread example
#LIB_OBJS = -lcurl -lnsl -lssl -lcrypto
LIB_OBJS = -lcurl -lnsl
all: $(PROGRAM) $(MAN_PAGES)
# "Static Pattern Rule" to build all programs
smugup: %: $(HEADERS) $(GEN_HEADERS) $(SMUG_OBJS)
$(E) " LD " $@
$(Q) $(LD) $(LDFLAGS) [email protected] $(CORE_OBJS) -o $@ $(LIB_OBJS)
smugls: %: $(HEADERS) $(GEN_HEADERS) $(SMUG_OBJS)
$(E) " LD " $@
$(Q) $(LD) $(LDFLAGS) [email protected] $(CORE_OBJS) -o $@ $(LIB_OBJS)
smugdown: %: $(HEADERS) $(GEN_HEADERS) $(SMUG_OBJS)
$(E) " LD " $@
$(Q) $(LD) $(LDFLAGS) [email protected] $(CORE_OBJS) -o $@ $(LIB_OBJS)
# build the objects
%.o: %.c $(HEADERS) $(GEN_HEADERS)
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
smugbatch_version.h:
$(E) " GENHDR " $@
$(Q) echo "/* Generated by make. */" > $@
$(Q) echo \#define SMUGBATCH_VERSION \"$(VERSION)\" >> $@
# man pages
%.1: %.xml
$(E) " XMLTO " $@
$(Q) xmlto man $?
.PRECIOUS: %.1
clean:
$(E) " CLEAN "
$(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f
$(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f
$(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f
$(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f
$(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f
$(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f
$(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f
$(Q) - rm -f core $(PROGRAM) $(GEN_HEADERS)
.PHONY: clean
release:
$(Q) - rm -f smugbatch-$(VERSION).tar.gz
$(Q) - rm -f smugbatch-$(VERSION).tar.bz2
head -1 ChangeLog | grep -q "to v$(VERSION)"
head -1 RELEASE-NOTES | grep -q "smugbatch $(VERSION)"
git commit -a -m "release $(VERSION)"
cat .git/refs/heads/master > .git/refs/tags/$(VERSION)
@ echo
git archive --format=tar --prefix=smugbatch-$(VERSION)/ HEAD | gzip -9v > smugbatch-$(VERSION).tar.gz
git archive --format=tar --prefix=smugbatch-$(VERSION)/ HEAD | bzip2 -9v > smugbatch-$(VERSION).tar.bz2
.PHONY: release