ObjFW  Diff

Differences From Artifact [2d1b114a41]:

To Artifact [e3a95b552a]:


62
63
64
65
66
67
68

69
70
71
72
73
74
75
	exit $2
}

srcs=""
out=""
objs=""
link="no"

lib="no"
out_prefix=""
out_suffix=""

while test x"$1" != "x"; do
	case "$1" in
		-o|--out)







>







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	exit $2
}

srcs=""
out=""
objs=""
link="no"
link_stdcpp="no"
lib="no"
out_prefix=""
out_suffix=""

while test x"$1" != "x"; do
	case "$1" in
		-o|--out)
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
		-*)
			echo "Unknown option: $1"
			exit 1
			;;
		*.m)
			srcs="$srcs $1"
			;;




		*)
			echo "Only .m files can be compiled!" 1>&2
			exit 1
			;;
	esac

	shift
done

if test x"$out" = x""; then
	echo "No output name specified! Use -o or --out!"
	exit 1
fi

for i in $srcs; do


	if test x"$lib" = x"yes"; then
		obj="${i%.m}.lib.o"
	elif test x"$plugin" = x"yes"; then
		obj="${i%.m}.plugin.o"
	else
		obj="${i%.m}.o"
	fi











	objs="$objs $obj"
	build="no"
	deps=$($OBJC -E -M $CPPFLAGS $i | sed 's/.*: //' | sed 's/\\//g')

	if test -f "$obj"; then
		for dep in $deps; do
			test "$dep" -nt $obj && build="yes"







>
>
>
>

|













>
>
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>







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
		-*)
			echo "Unknown option: $1"
			exit 1
			;;
		*.m)
			srcs="$srcs $1"
			;;
		*.mm)
			srcs="$srcs $1"
			link_stdcpp="yes"
			;;
		*)
			echo "Only .m and .mm files can be compiled!" 1>&2
			exit 1
			;;
	esac

	shift
done

if test x"$out" = x""; then
	echo "No output name specified! Use -o or --out!"
	exit 1
fi

for i in $srcs; do
	case $i in
		*.m)
			if test x"$lib" = x"yes"; then
				obj="${i%.m}.lib.o"
			elif test x"$plugin" = x"yes"; then
				obj="${i%.m}.plugin.o"
			else
				obj="${i%.m}.o"
			fi
			;;
		*.mm)
			if test x"$lib" = x"yes"; then
				obj="${i%.mm}.lib.o"
			elif test x"$plugin" = x"yes"; then
				obj="${i%.mm}.plugin.o"
			else
				obj="${i%.mm}.o"
			fi
			;;
	esac
	objs="$objs $obj"
	build="no"
	deps=$($OBJC -E -M $CPPFLAGS $i | sed 's/.*: //' | sed 's/\\//g')

	if test -f "$obj"; then
		for dep in $deps; do
			test "$dep" -nt $obj && build="yes"
201
202
203
204
205
206
207


208
209
210
211
212
213
214
215
216
217
218
219
			status_compile_failed $i $?
		status_compiled $i
	fi
done

test x"$lib" = x"no" -a x"$plugin" = x"no" && \
	out_suffix="$($OBJFW_CONFIG --prog-suffix)"



if test x"$lib" = x"yes"; then
	export LIB="$out_prefix$out$out_suffix"
	LDFLAGS="$LDFLAGS $($OBJFW_CONFIG --lib-ldflags)"
fi

if test ! -f "$out_prefix$out$out_suffix" -o x"$link" = x"yes"; then
	status_linking $out_prefix$out$out_suffix
	$OBJC -o $out_prefix$out$out_suffix $objs $LIBS $LDFLAGS || \
		status_link_failed $out $?
	status_linked $out_prefix$out$out_suffix
fi







>
>












219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
			status_compile_failed $i $?
		status_compiled $i
	fi
done

test x"$lib" = x"no" -a x"$plugin" = x"no" && \
	out_suffix="$($OBJFW_CONFIG --prog-suffix)"

test x"$link_stdcpp" = x"yes" && LIBS="$LIBS -lstdc++"

if test x"$lib" = x"yes"; then
	export LIB="$out_prefix$out$out_suffix"
	LDFLAGS="$LDFLAGS $($OBJFW_CONFIG --lib-ldflags)"
fi

if test ! -f "$out_prefix$out$out_suffix" -o x"$link" = x"yes"; then
	status_linking $out_prefix$out$out_suffix
	$OBJC -o $out_prefix$out$out_suffix $objs $LIBS $LDFLAGS || \
		status_link_failed $out $?
	status_linked $out_prefix$out$out_suffix
fi