Gordons Projects

--> Projects Top-Level GIT

Updated the build & makefile to allow for building the
[wiringPi] / build
1 #!/bin/bash
2
3 check-make-ok()
4 {
5   if [ $? != 0 ]; then
6     echo ""
7     echo "Make Failed..."
8     echo "Please check the messages and fix any problems. If you're still stuck,"
9     echo "then please email all the output and as many details as you can to"
10     echo "  projects@drogon.net"
11     echo ""
12     exit 1
13   fi
14 }
15
16 if [ x$1 = "xclean" ]; then
17   echo Cleaning
18   echo
19   cd wiringPi
20   make clean
21   cd ../gpio
22   make clean
23   cd ../examples
24   make clean
25   exit
26 fi
27
28 if [ x$1 = "xuninstall" ]; then
29   echo Uninstalling
30   echo
31   echo "WiringPi library"
32   cd wiringPi
33   sudo make uninstall
34   echo
35   echo "GPIO Utility"
36   cd ../gpio
37   sudo make uninstall
38   cd ..
39   exit
40 fi
41
42
43   echo "wiringPi Build script"
44   echo "====================="
45   echo
46
47 # Check for I2C being installed...
48 #       ... and if-so, then automatically make the I2C helpers
49
50   if [ -f /usr/include/linux/i2c-dev.h ]; then
51     grep -q i2c_smbus_read_byte /usr/include/linux/i2c-dev.h
52     if [ $? = 0 ]; then
53       target=i2c
54       echo "Building wiringPi with the I2C helper libraries."
55     else
56       target=all
57       echo "The wiringPi I2C helper libraries will not be built."
58     fi
59   fi
60
61   echo
62   echo "WiringPi library"
63   cd wiringPi
64   sudo make uninstall
65   make $target
66   check-make-ok
67   sudo make install
68   check-make-ok
69
70   echo
71   echo "GPIO Utility"
72   cd ../gpio
73   make
74   check-make-ok
75   sudo make install
76   check-make-ok
77
78 # echo
79 # echo "Examples"
80 # cd ../examples
81 # make
82 # cd ..
83
84 echo
85 echo All Done.