ObjFW  Check-in [702c33d74b]

Overview
Comment:Add --compile to objfw-config.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 702c33d74bbd0131f84d67c67323d98d1b58cdc521e47a1d557a8340e852a558
User & Date: js on 2010-04-17 17:37:26
Other Links: manifest | tags
Context
2010-04-17
17:44
Show the output name if there's nothing to do in objfw-config. check-in: 6791ca9a7a user: js tags: trunk
17:37
Add --compile to objfw-config. check-in: 702c33d74b user: js tags: trunk
17:03
Add --objc to objfw-config. check-in: 2fa4b3a692 user: js tags: trunk
Changes

Modified objfw-config.in from [b580d9b32d] to [93752ea7d4].

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
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() {

	echo "$0: Available arguments are:"
	echo
	echo "	--all		Outputs all flags + libs"
	echo "	--cflags	Outputs the required CFLAGS"

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



	echo










































	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)







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



















>
>
>
>







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
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"

				if test ! -f "$obj" -o "$1" -nt "$obj"; 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 x"$link" = x"yes"; then
		echo "Linking $out..."
		$OBJC -o $out $objs $LIBS $LDFLAGS
		exit $?
	fi

	echo "Nothing to do..."
	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)
68
69
70
71
72
73
74
75
76
77
78
79
80
81
		--rpath)
			echo "$LDFLAGS_RPATH"
			;;
		--version)
			echo "$VERSION"
			;;
		*)
			echo "Invalid option: $1" >/dev/stderr
			exit 1
			;;
	esac

	shift
done







|






119
120
121
122
123
124
125
126
127
128
129
130
131
132
		--rpath)
			echo "$LDFLAGS_RPATH"
			;;
		--version)
			echo "$VERSION"
			;;
		*)
			echo "Invalid option: $1" 1>&2
			exit 1
			;;
	esac

	shift
done