-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile.in
executable file
·223 lines (182 loc) · 7.71 KB
/
Makefile.in
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#
# DO NOT EDIT THIS FILE
#
#
SHELL = @SHELL@
top_srcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
@SET_MAKE@
CCDEPMODE = @CCDEPMODE@
BINEXEC = wraith@EXEEXT@
STATICMAKEFILES = lib/Makefile src/Makefile Makefile
CONFIGFILES = build/config.cache build/config.log build/config.status src/config.h src/buildinfo.h
DISTROFILES = README.md LICENSE build doc scripts lib Makefile.in build.sh configure src BSDmakefile
EXCLUDES = $(CONFIGFILES) $(STATICMAKEFILES)
COMMIT_FULL := $(shell git log -1 --pretty=format:%H HEAD)
COMMIT_SHORT := $(shell git log -1 --pretty=format:%h HEAD)
BRANCH := $(shell git branch --no-color | grep "^*" | sed -e 's/^\* //')
BUILDTS := $(shell git log -1 --pretty=format:%ct HEAD)
VERSION := $(shell git describe --candidates=2)
DISTRIB = wraith-$(VERSION)
HELPFILE = doc/help.txt
# defaults
CXX = @CXX@
CC = @CC@
LD_DYNAMIC = @CXX@
LD_STATIC = @CXX@ @STATIC@
LD_DEBUG = @CXX@
STRIP = @STRIP@
DIFF = @DIFF@
#LIBS = @LIBS@
LIBS = @LIBS@
INCLUDES = @TCL_INCLUDES@ @SSL_INCLUDES@
DEBCXXFLAGS = -DDEBUG -fno-inline -g3 -ggdb3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wshadow -Wpointer-arith @GCC3DEB@ @GCC4DEB@ @DEBCXXFLAGS@
DEBLDFLAGS= @DEBLDFLAGS@
CFLGS = @GCC3_CFLAGS@
CXXFLAGS = @CXXFLAGS@ $(CFLGS) @GCC3_CXXFLAGS@ -fno-rtti
MAKEFLAGS = -s
MAKE_STATIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'LD=$(LD_STATIC)' 'INCLUDES=$(INCLUDES)' \
'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_STATIC' \
'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
MAKE_DYNAMIC = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD_DYNAMIC)' 'INCLUDES=$(INCLUDES)' \
'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
'STRIP=$(STRIP)' 'CXXFLAGS=$(CXXFLAGS)' 'CFLGS=$(CFLGS) -DBIN_TYPE_DYNAMIC' \
'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(wraith)'
MAKE_DEBUG = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'LD=$(LD_DEBUG) -g' 'INCLUDES=$(INCLUDES)' \
'CCDEPMODE=$(CCDEPMODE)' 'BRANCH=$(BRANCH)' 'COMMIT=$(COMMIT_SHORT)' 'BUILDTS=$(BUILDTS)' 'VERSION=$(VERSION)' \
'STRIP=touch' 'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS) -DBIN_TYPE_DYNAMIC' \
'DEBLDFLAGS=$(DEBLDFLAGS)' 'LIBS=$(LIBS)' 'EGGEXEC=$(BINEXEC)' 'EGGBUILD=(debug)'
MAKE_UTILS = $(MAKE) 'MAKE=$(MAKE)' 'CXX=$(CXX)' 'CC=$(CC)' 'STRIP=touch' 'INCLUDES=$(INCLUDES)' \
'CCDEPMODE=$(CCDEPMODE)' 'DEBLDFLAGS=$(DEBLDFLAGS)' \
'CXXFLAGS=$(CXXFLAGS) $(DEBCXXFLAGS)' 'CFLGS=$(CFLGS) $(DEBCXXFLAGS)' 'LIBS=$(LIBS)' 'LD=$(LD_DEBUG) -g'
.PHONY: checkclean.static checkclean.dynamic checkclean.debug lib wraith dwraith lib.debug debug test general sorthelp sort indent tar distrib distclean clean cleanutils test all dynamic static tags libdefs
all: dynamic
test:
cleanutils:
@rm -f src/sorthelp@EXEEXT@
clean: cleanutils
+@cd src && $(MAKE) clean
-+@cd lib && $(MAKE) clean
@rm -f $(BINEXEC) build/stamp.* *~ src/*~ configure.temp .mangled stamp.*
@rm -f ts@EXEEXT@
distclean: clean
@rm -rf *-$(VERSION)/ autom4te.cache/ autoscan.log configure.scan
@rm -rf src/.deps/ src/compat/.deps/ src/strucutres/.deps/ src/mod/*.mod/.deps/ src/crypto/.deps src/.defs/
-+@cd lib && $(MAKE) distclean
@rm -f $(STATICMAKEFILES) $(CONFIGFILES) config.h config.log config.status
distrib: clean
@rm -rf $(DISTRIB)/
-+@cd lib && $(MAKE) distclean
@mkdir $(DISTRIB) && cp -R $(DISTROFILES) $(DISTRIB)
@rm -rf `find $(DISTRIB)/ \( -name '*~' -o -name '*#' -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' -o -name '.gitignore' -o -name '.*.swp' \) -type f -print`
@rm -rf `find $(DISTRIB)/ \( -name '.git' -o -name '.deps' \) -type d -print`
@for s in $(EXCLUDES); do \
rm -rf $(DISTRIB)/$$s; \
done;
@sed \
-e 's/^COMMIT_FULL .*/COMMIT_FULL = $(COMMIT_FULL)/' \
-e 's/^COMMIT_SHORT .*/COMMIT_SHORT = $(COMMIT_SHORT)/' \
-e 's/^BRANCH .*/BRANCH = $(BRANCH)/' \
-e 's/^BUILDTS .*/BUILDTS = $(BUILDTS)/' \
-e 's/^VERSION .*/VERSION = $(VERSION)/' \
$(DISTRIB)/Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp $(DISTRIB)/Makefile.in
@sed -e 's/GIT_REQUIRED=1/GIT_REQUIRED=0/' configure > $(DISTRIB)/configure
# @for s in `find $(DISTRIB)/src/ -name '*.h' -or -name '*.c'`; do mangle -rnw $$s > /dev/null 2>&1; done
tags:
@which cscope >/dev/null 2>&1 && cscope -Rbq || :
@which ctags >/dev/null 2>&1 && ctags -R || :
tar: distrib
tar -czvf $(DISTRIB).tar.gz $(DISTRIB)/
ls -al $(DISTRIB).tar.gz
# rm -rf $(DISTRIB)/
# cd ../ && rm -rf distrib/
indent:
@ifiles="`find src -name '*.h' -or -name '*.c'`"; \
for s in $$ifiles; \
do \
INDENT_PROFILE=private/indent.pro indent $$s; \
done
sort: sorthelp
@(if test "x`tail -n 1 $(HELPFILE)`" != "x::end"; then \
echo "::end" >> $(HELPFILE); \
fi)
# @(sed $(HELPFILE) -e "s/^$$/ /" > help~ && mv -f help~ $(HELPFILE)) || rm -f help~
@(sed -r -e :a -e 's/^$$/ /' -e '$$!N;s/^ \n:/:/;ta' -e 'P;D' $(HELPFILE) > help~ && mv -f help~ $(HELPFILE)) || rm -f help~
@cp -f $(HELPFILE) help.txt~
@(src/sorthelp@EXEEXT@ $(HELPFILE) $(HELPFILE) || (cp -f help.txt~ $(HELPFILE); echo "Sort failed, restoring backup."))
@rm -f help.txt~
sorthelp: src/sorthelp.cc
+@cd src && ${MAKE_UTILS} sorthelp
libdefs: src/.defs/libcrypto_post.h src/.defs/libssl_post.h src/.defs/libtcl_post.h \
src/.defs/libcrypto_pre.h src/.defs/libssl_pre.h src/.defs/libtcl_pre.h \
src/.defs/libcrypto_exports src/.defs/libssl_exports src/.defs/libtcl_exports
src/.defs/libcrypto_post.h src/.defs/libcrypto_pre.h src/.defs/libcrypto_exports: src/libcrypto.cc \
src/generate_defs.sh src/generate_symbol.sh src/dl.h
@CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" INCLUDES="$(INCLUDES)" \
SED="sed" src/generate_defs.sh src/libcrypto.cc || exit 1
src/.defs/libssl_post.h src/.defs/libssl_pre.h src/.defs/libssl_exports: src/libssl.cc \
src/generate_defs.sh src/generate_symbol.sh src/dl.h
@CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" INCLUDES="$(INCLUDES)" \
SED="sed" src/generate_defs.sh src/libssl.cc || exit 1
src/.defs/libtcl_post.h src/.defs/libtcl_pre.h src/.defs/libtcl_exports: src/libtcl.cc \
src/generate_defs.sh src/generate_symbol.sh src/dl.h
@CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" INCLUDES="$(INCLUDES)" \
SED="sed" src/generate_defs.sh src/libtcl.cc || exit 1
src/.defs/exports: Makefile \
src/.defs/libcrypto_exports src/.defs/libssl_exports src/.defs/libtcl_exports
@echo "Generating $@"
@{ \
echo "{"; \
echo "bfd_exports_stub;"; \
cat src/.defs/*_exports; \
echo "};"; \
} > $@.tmp
@if ! cmp -s $@.tmp $@; then \
mv -f $@.tmp $@; \
else \
rm -f $@.tmp; \
touch $@; \
fi
general: libdefs src/.defs/exports
.NOTPARALLEL: checkclean.static checkclean.dynamic checkclean.debug
checkclean.static:
@(if test -f build/stamp.dynamic -o -f build/stamp.debug; then \
echo "[*] Cleaning up alternate build"; \
$(MAKE) MAKEFLAGS=-s clean; \
fi)
@touch build/stamp.static
checkclean.dynamic:
@(if test -f build/stamp.static -o -f build/stamp.debug; then \
echo "[*] Cleaning up alternate build"; \
$(MAKE) MAKEFLAGS=-s clean; \
fi)
@touch build/stamp.dynamic
checkclean.debug:
@(if test -f build/stamp.static -o -f build/stamp.dynamic; then \
echo "[*] Cleaning up alternate build"; \
$(MAKE) MAKEFLAGS=-s clean; \
fi)
@touch build/stamp.debug
lib:
+@cd lib && $(MAKE)
dynamic: checkclean.dynamic lib general
@echo ""
@echo "Making dynamic binary"
@echo ""
+@cd src && $(MAKE_DYNAMIC) ../$(BINEXEC)
static: checkclean.static lib general
@echo ""
@echo "Making static binary"
@echo ""
+@cd src && $(MAKE_STATIC) ../$(BINEXEC)
dwraith: debug
lib.debug:
+@cd lib && $(MAKE) debug
debug: checkclean.debug lib.debug general
@echo ""
@echo "Making debug binary"
@echo ""
+@cd src && $(MAKE_DEBUG) ../$(BINEXEC)
#safety hash