-
Notifications
You must be signed in to change notification settings - Fork 16
/
makefile.aos4.standalone
253 lines (202 loc) · 6.26 KB
/
makefile.aos4.standalone
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#
# This is a makefile for building SimpleGit for AmigaOS
#
# Define USE_AMISSL=yes if you wish to build the AmiSSL-based
# version.
#
###########################################
BUILDDIR = build-amiga
###########################################
COMMON_CFLAGS=-O2
###########################################
ifeq ($(USE_AMISSL),yes)
OPENSSL_CFLAGS=\
-std=c11 \
-Ibuild-deps/amissl4/AmiSSL/Developer/include/ \
-Ibuild-amiga \
-Iamissl-support \
-include "amissl-wrapper.h" \
-Wno-strict-prototypes \
-Winvalid-pch \
-DUSE_AMISSL
OPENSSL_LDFLAGS=-Ibuild-deps/amissl4/AmiSSL/Developer/include/ amissl-support/amissl-stubs.c
else
OPENSSL_CFLAGS=-Iinterim-openssl/openssl/repo/include
OPENSSL_LDFLAGS=-Linterim-openssl/openssl/repo/ -lssl -lcrypto
endif
###########################################
LIBSSH2_SRC_DIR = libssh2/src/
LIBSSH2_SRCS = \
$(sort \
$(LIBSSH2_SRC_DIR)/agent.c \
$(LIBSSH2_SRC_DIR)/channel.c \
$(LIBSSH2_SRC_DIR)/comp.c \
$(LIBSSH2_SRC_DIR)/crypt.c \
$(LIBSSH2_SRC_DIR)/global.c \
$(LIBSSH2_SRC_DIR)/keepalive.c \
$(LIBSSH2_SRC_DIR)/kex.c \
$(LIBSSH2_SRC_DIR)/hostkey.c \
$(LIBSSH2_SRC_DIR)/mac.c \
$(LIBSSH2_SRC_DIR)/misc.c \
$(LIBSSH2_SRC_DIR)/openssl.c \
$(LIBSSH2_SRC_DIR)/packet.c \
$(LIBSSH2_SRC_DIR)/session.c \
$(LIBSSH2_SRC_DIR)/transport.c \
$(LIBSSH2_SRC_DIR)/userauth.c \
)
LIBSSH2_BUILDDIR = $(BUILDDIR)/libssh2
LIBSSH2_OBJS = $(patsubst $(LIBSSH2_SRC_DIR)/%.c,$(LIBSSH2_BUILDDIR)/%.o,$(LIBSSH2_SRCS))
LIBSSH2_DEPS = $(LIBSSH2_OBJS:.o=.d)
LIBSSH2_CFLAGS = \
-std=c11 \
-DHAVE_INTTYPES_H \
-DLIBSSH2_OPENSSL \
-DHAVE_IOCTLSOCKET_CASE \
-Ilibssh2/src \
-Ilibssh2/include \
-Ilibssh2-amiga \
$(OPENSSL_CFLAGS)
###########################################
LIBGIT2_SRC_DIR = libgit2
LIBGIT2_SRCS = \
$(sort \
$(wildcard $(LIBGIT2_SRC_DIR)/src/*.c) \
$(wildcard $(LIBGIT2_SRC_DIR)/src/transports/*.c) \
$(wildcard $(LIBGIT2_SRC_DIR)/src/xdiff/*.c) \
$(wildcard $(LIBGIT2_SRC_DIR)/deps/http-parser/*.c) \
$(wildcard $(LIBGIT2_SRC_DIR)/deps/zlib/*.c) \
$(LIBGIT2_SRC_DIR)/deps/regex/regex.c \
$(LIBGIT2_SRC_DIR)/src/hash/hash_generic.c \
$(LIBGIT2_SRC_DIR)/src/unix/realpath.c \
)
LIBGIT2_BUILDDIR = $(BUILDDIR)/libgit2
LIBGIT2_OBJS = $(patsubst $(LIBGIT2_SRC_DIR)/%.c,$(LIBGIT2_BUILDDIR)/%.o,$(LIBGIT2_SRCS))
LIBGIT2_DEPS = $(LIBGIT2_OBJS:.o=.d)
LIBGIT2_CFLAGS = \
-DGIT_ARCH_32 \
-DNO_ADDRINFO \
-DNO_GZIP \
-DNO_MMAP \
-DNO_READDIR_R \
-DNO_VIZ \
-DSTDC \
-D_FILE_OFFSET_BITS=64 \
-D_GNU_SOURCE \
-U__STRICT_ANSI__ \
-DAMIGA \
-DGIT_OPENSSL \
-DGIT_SSH \
-Wall \
-Wextra \
-fstack-usage \
-ffunction-sections -fdata-sections \
-Wstack-usage=512 \
-Wno-missing-field-initializers \
-Wstrict-aliasing=2 \
-Wstrict-prototypes \
-Wdeclaration-after-statement \
-Wno-unused-function \
-Ilibgit2/src \
-Ilibgit2/include \
-Ilibgit2/deps/regex \
-Ilibgit2/deps/http-parser \
-Ilibgit2/deps/zlib \
$(OPENSSL_CFLAGS) \
-Ilibssh2/include \
-Ibuild-deps/Local/common/include
###########################################
SGIT_SRC_DIR = src
SGIT_SRCS = \
$(sort \
$(wildcard $(SGIT_SRC_DIR)/*.c) \
$(wildcard $(SGIT_SRC_DIR)/common/*.c) \
$(wildcard $(SGIT_SRC_DIR)/common/utils/*.c) \
$(wildcard $(SGIT_SRC_DIR)/builtin/*.c) \
)
SGIT_BUILDDIR = $(BUILDDIR)/sgit-objs
SGIT_OBJS = $(patsubst $(SGIT_SRC_DIR)/%.c,$(SGIT_BUILDDIR)/%.o,$(SGIT_SRCS))
SGIT_DEPS = $(SGIT_OBJS:.o=.d)
SGIT_CFLAGS = \
-DNO_OPENSSL \
-DOPENSSL_SHA1 \
-DHAVE_SGIT_VERSION_H \
-Wno-missing-field-initializers \
-std=gnu99 \
-Wall \
-Wextra \
-DUSE_SSL \
-Ilibgit2/include \
-Isrc \
-Isrc/builtin \
-Isrc/common/ \
-Isrc/common/utils/ \
$(OPENSSL_CFLAGS) \
-Ibuild-deps/Local/common/include \
-I$(SGIT_BUILDDIR) \
-fstack-usage \
-Wstack-usage=512 \
-g
SGIT_LDFLAGS = \
-Lbuild-deps/Local/newlib/lib \
-lauto \
$(OPENSSL_LDFLAGS) \
-Wl,--gc-sections
###########################################
.PHONY: all
all: $(BUILDDIR)/sgit
###########################################
include makefile.aos4.common
###########################################
ifeq ($(USE_AMISSL),yes)
GCH=build-amiga/amissl-wrapper.h.gch
$(GCH): amissl-support/amissl-wrapper.h
mkdir -p $(dir $@)
ppc-amigaos-gcc $< -o $@ $(COMMON_CFLAGS) $(OPENSSL_CFLAGS) -ffunction-sections -fdata-sections
else
GCH=
endif
###########################################
$(BUILDDIR)/sgit.debug: $(LIBSSH2_OBJS) $(LIBGIT2_OBJS) $(SGIT_OBJS)
ppc-amigaos-gcc $(LIBSSH2_OBJS) $(LIBGIT2_OBJS) $(SGIT_OBJS) -g -o$@ $(SGIT_LDFLAGS) -lunix
$(BUILDDIR)/sgit: $(BUILDDIR)/sgit.debug
ppc-amigaos-strip --strip-all --strip-unneeded-rel-relocs -R.comment -R.eh_frame -o $@ $<
###########################################
.PHONY: clean
clean:
rm -Rf $(BUILDDIR)
###########################################
define LIBSSH2_DEP_template =
$(1): libssh2
endef
# Add the libssh2 template to each of the libgit2 objects
$(foreach obj,$(LIBSSH2_SRCS),$(eval $(call LIBSSH2_DEP_template,$(obj))))
###########################################
$(LIBSSH2_BUILDDIR)/%.o: $(LIBSSH2_SRC_DIR)/%.c $(GCH)
mkdir -p $(dir $@)
ppc-amigaos-gcc $(COMMON_CFLAGS) $(LIBSSH2_CFLAGS) -MMD -MP -c $< -o $@
###########################################
$(LIBGIT2_BUILDDIR)/%.o: $(LIBGIT2_SRC_DIR)/%.c
mkdir -p $(dir $@)
ppc-amigaos-gcc $(COMMON_CFLAGS) $(LIBGIT2_CFLAGS) -MMD -MP -c $< -o $@
# The libgit2 depends on the presence of openssl
# This macro adds the openssl dependency for the target
define OPENSSL_DEP_template =
$(1): $(OPENSSL)
endef
# Add the openssl template to each of the libgit2 objects
$(foreach obj,$(LIBGIT2_OBJS),$(eval $(call OPENSSL_DEP_template,$(obj))))
###########################################
COMMITS := $(shell git rev-list HEAD --count)
$(SGIT_BUILDDIR)/sgit-version.h:
@mkdir -p $(SGIT_BUILDDIR)
echo "#define SIMPLEGIT_REVISION_STRING \"$(COMMITS)\"" >$@
echo "#define SIMPLEGIT_DATE_STRING \"$(shell date +%d.%m.%Y)\"" >>$@
###########################################
$(SGIT_BUILDDIR)/%.o: $(SGIT_SRC_DIR)/%.c
mkdir -p $(dir $@)
ppc-amigaos-gcc $(COMMON_CFLAGS) $(SGIT_CFLAGS) -MMD -MP -c $< -o $@
# Manual dependencies for those files that depend on a generated file
$(SGIT_BUILDDIR)/builtin/version.o: $(SGIT_BUILDDIR)/sgit-version.h
$(SGIT_BUILDDIR)/git.o: $(SGIT_BUILDDIR)/sgit-version.h
###########################################
-include $(LIBSSH2_DEPS) $(LIBGIT2_DEPS) $(SGIT_DEPS)