ObjFW  Check-in [53f21dd6a8]

Overview
Comment:Move objfw-config --compile into a new script called objfw-compile.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 53f21dd6a8fdfe23e1b42a5b83bf126ac3b339b0a90bf1f9b33ec36eb21b7598
User & Date: js on 2010-04-17 18:54:33
Other Links: manifest | tags
Context
2010-04-17
21:43
Better method names for file- and stream-related exceptions. check-in: 1f19713fd3 user: js tags: trunk
18:54
Move objfw-config --compile into a new script called objfw-compile. check-in: 53f21dd6a8 user: js tags: trunk
18:05
Real dependency checking for objfw-config's --compile. check-in: b03c4eeda4 user: js tags: trunk
Changes

Modified Makefile from [26e4d3cc1d] to [3d21754b5e].

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
	    config.status	\
	    extra.mk		\
	    objfw-config

include buildsys.mk

install-extra:
	for i in objfw-config; do \
		${INSTALL_STATUS}; \
		if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \
			${INSTALL_OK}; \
		else \
			${INSTALL_FAILED}; \
		fi \
	done

uninstall-extra:
	for i in objfw-config; do \
		if test -f ${DESTDIR}${bindir}/$$i; then \
			if rm -f ${DESTDIR}${bindir}/$$i; then \
				${DELETE_OK}; \
			else \
				${DELETE_FAILED}; \
			fi \
		fi \







|









|







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
	    config.status	\
	    extra.mk		\
	    objfw-config

include buildsys.mk

install-extra:
	for i in objfw-config objfw-compile; do \
		${INSTALL_STATUS}; \
		if ${MKDIR_P} ${DESTDIR}${bindir} && ${INSTALL} -m 755 $$i ${DESTDIR}${bindir}/$$i; then \
			${INSTALL_OK}; \
		else \
			${INSTALL_FAILED}; \
		fi \
	done

uninstall-extra:
	for i in objfw-config objfw-compile; do \
		if test -f ${DESTDIR}${bindir}/$$i; then \
			if rm -f ${DESTDIR}${bindir}/$$i; then \
				${DELETE_OK}; \
			else \
				${DELETE_FAILED}; \
			fi \
		fi \

Added objfw-compile version [4e093bb57d].











































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#!/bin/sh
if ! which objfw-config 2>&1 >/dev/null; then
	echo "You need to have ObjFW and objfw-config installed!"
	exit 1
fi

CPPFLAGS="$CPPFLAGS $(objfw-config --cppflags)"
OBJC="$(objfw-config --objc)"
OBJCFLAGS="$OBJCFLAGS $(objfw-config --objcflags)"
LIBS="$LIBS $(objfw-config --libs)"
LDFLAGS="$LDFLAGS $(objfw-config --ldflags)"

if test x"$1" = "x" -o x"$2" = "x"; then
	echo "Syntax: objfw-compile outname source1.m source2.m ..."
	exit 1
fi

out="$1"
objs=""
link="no"
shift

case "$out" in
	*.c | *.C | *.cpp | *.cxx | *.C | *.h | *.m | *.mm | *.M)
		echo "The first paramter must be the output name!" 1>&2
		exit 1
		;;
esac

while test x"$1" != "x"; do
	case "$1" in
		*.m)
			obj="${1%.m}.o"
			objs="$objs $obj"
			build="no"
			deps=$($OBJC -E -M $CPPFLAGS $ENV_CPPFLAGS $1 | \
			       sed 's/.*: //' | sed 's/\\//g')

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

			if test x"$build" = x"yes"; then
				link="yes"
				echo "Compiling $1..."
				$OBJC $CPPFLAGS $OBJCFLAGS -c -o $obj $1 || \
					exit $?
			fi
			;;
		*)
			echo "Only .m files can be compiled!" 1>&2
			exit 1
			;;
	esac

	shift
done

if test ! -f "$out" -o x"$link" = x"yes"; then
	echo "Linking $out..."
	$OBJC -o $out $objs $LIBS $ENV_LIBS $LDFLAGS $ENV_LDFLAGS
	exit $?
fi

echo "Nothing to do for $out..."

Modified objfw-config.in from [f1957bd739] to [d92d8227a8].

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
#!/bin/sh
ENV_CPPFLAGS="$CPPFLAGS"
ENV_OBJCFLAGS="$OBJCFLAGS"
ENV_LIBS="$LIBS"
ENV_LDFLAGS="$LDFLAGS"

prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
CFLAGS=""
CPPFLAGS="-I@includedir@"
CXXFLAGS=""
OBJC="@OBJC@"
OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @NO_WARN_UNUSED@ @ATOMIC_OBJCFLAGS@"
LDFLAGS=""
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
VERSION="0.3-dev"

show_help() {
	cat <<__EOF__
$0: Available arguments are:

	--all		Outputs all flags + libs
	--cflags	Outputs the required CFLAGS
	--compile out	Compiles and links the specified files if they changed
	--cppflags	Outputs the required CPPFLAGS
	--cxxflags	Outputs the required CXXFLAGS
	--objc		Outputs the OBJC used to compile ObjFW
	--objcflags	Outputs the required OBJCFLAGS
	--ldflags	Outputs the required LDFLAGS
	--rpath		Outputs LDFLAGS for using rpath
	--libs		Outputs the required LIBS
	--version	Outputs the installed version
__EOF__
	exit 0
}

compile() {
	out="$1"
	objs=""
	link="no"
	shift

	case "$out" in
		*.c | *.C | *.cpp | *.cxx | *.C | *.h | *.m | *.mm | *.M)
			echo "The first paramter must be the output name!" 1>&2
			exit 1
			;;
	esac

	while test x"$1" != "x"; do
		case "$1" in
			*.m)
				obj="${1%.m}.o"
				objs="$objs $obj"
				build="no"
				deps=$($OBJC -E -M $CPPFLAGS $ENV_CPPFLAGS $1 |\
				       sed 's/.*: //' | sed 's/\\//g')

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

				if test x"$build" = x"yes"; then
					link="yes"
					echo "Compiling $1..."
					$OBJC $CPPFLAGS $OBJCFLAGS \
						$ENV_CPPFLAGS $ENV_OBJCFLAGS \
						-c -o $obj $1 || exit $?
				fi
				;;
			*)
				echo "Only .m files can be compiled!" 1>&2
				exit 1
				;;
		esac

		shift
	done

	if test ! -f "$out" -o x"$link" = x"yes"; then
		echo "Linking $out..."
		$OBJC -o $out $objs $LIBS $ENV_LIBS $LDFLAGS $ENV_LDFLAGS
		exit $?
	fi

	echo "Nothing to do for $out..."
	exit 0
}

test -z "$1" && show_help

while test ! -z "$1"; do
	case "$1" in
		--all)
			echo "$CFLAGS"
			echo "$CPPFLAGS"
			echo "$CXXFLAGS"
			echo "$OBJCFLAGS"
			echo "$LDFLAGS"
			echo "$RPATH_LDFLAGS"
			echo "$LIBS"
			;;
		--cflags)
			echo "$CFLAGS"
			;;
		--compile)
			shift
			compile $@
			;;
		--cppflags)
			echo "$CPPFLAGS"
			;;
		--cxxflags)
			echo "$CXXFLAGS"
			;;
		--objc)

<
<
<
<
<

















|



<












<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















<
<
<
<







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
#!/bin/sh





prefix="@prefix@"
exec_prefix="@exec_prefix@"
libdir="@libdir@"
CFLAGS=""
CPPFLAGS="-I@includedir@"
CXXFLAGS=""
OBJC="@OBJC@"
OBJCFLAGS="@GNU_RUNTIME@ -fexceptions -fobjc-exceptions"
OBJCFLAGS="$OBJCFLAGS -fconstant-string-class=OFConstString"
OBJCFLAGS="$OBJCFLAGS @NO_CONST_CFSTRINGS@ @NO_WARN_UNUSED@ @ATOMIC_OBJCFLAGS@"
LDFLAGS=""
LDFLAGS_RPATH="@LDFLAGS_RPATH@"
LIBS="-L${libdir} -lobjfw @LIBS@"
VERSION="0.3-dev"

show_help() {
	cat <<__EOF__
objfw-config: Available arguments are:

	--all		Outputs all flags + libs
	--cflags	Outputs the required CFLAGS

	--cppflags	Outputs the required CPPFLAGS
	--cxxflags	Outputs the required CXXFLAGS
	--objc		Outputs the OBJC used to compile ObjFW
	--objcflags	Outputs the required OBJCFLAGS
	--ldflags	Outputs the required LDFLAGS
	--rpath		Outputs LDFLAGS for using rpath
	--libs		Outputs the required LIBS
	--version	Outputs the installed version
__EOF__
	exit 0
}



























































test -z "$1" && show_help

while test ! -z "$1"; do
	case "$1" in
		--all)
			echo "$CFLAGS"
			echo "$CPPFLAGS"
			echo "$CXXFLAGS"
			echo "$OBJCFLAGS"
			echo "$LDFLAGS"
			echo "$RPATH_LDFLAGS"
			echo "$LIBS"
			;;
		--cflags)
			echo "$CFLAGS"
			;;




		--cppflags)
			echo "$CPPFLAGS"
			;;
		--cxxflags)
			echo "$CXXFLAGS"
			;;
		--objc)