File: build

package info (click to toggle)
meanwhile 1.0.2-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,732 kB
  • ctags: 3,503
  • sloc: ansic: 13,856; sh: 8,360; makefile: 145
file content (37 lines) | stat: -rwxr-xr-x 655 bytes parent folder | download | duplicates (5)
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

#! /bin/sh


CC=gcc
PKG_CONFIG=/usr/bin/pkg-config


function build() {
    if (echo "$1" | grep '\.c$' > /dev/null) ; then
        SAMPLE=$(echo "$1" | sed 's/\.c$//')
        SOURCE="$1"
    else
        SAMPLE="$1"
        SOURCE="${SAMPLE}.c"
    fi

    if test -z "$SOURCE" ; then
	echo "please specify a target to build"
	return 1

    elif test ! -f "$SOURCE" ; then
	echo "file not found: $SOURCE"
	return 1
    fi

    PKG_CONFIG_PATH="$PKG_CONFIG_PATH":/home/siege/local//lib/pkgconfig
    export PKG_CONFIG_PATH

    CFLAGS=`$PKG_CONFIG --libs --cflags glib-2.0 meanwhile`

    "$CC" $CFLAGS -o "$SAMPLE" "$SOURCE"
    return $?
}


build $1