| 1 | #!/bin/sh |
| 2 | # |
| 3 | # Platform Configurator (pconf) calling script |
| 4 | # |
| 5 | # Edit only if you are the vendor, end users should not modify this file! |
| 6 | # |
| 7 | |
| 8 | # ############################################################################## |
| 9 | # |
| 10 | # Vendor Editable Section |
| 11 | # |
| 12 | |
| 13 | # Source files prefix directory: |
| 14 | # |
| 15 | SRC_DIR=sar |
| 16 | |
| 17 | # Platforms configuration file, this file lists all defined platforms this |
| 18 | # program is ported to: |
| 19 | # |
| 20 | PCONF_PLATFORMS_INI=$SRC_DIR/platforms.ini |
| 21 | |
| 22 | # This platform information file: |
| 23 | # |
| 24 | PCONF_THIS_PLATFORM_INI=$SRC_DIR/this_platform.ini |
| 25 | |
| 26 | # Output Makefile (should be same as the one specified in |
| 27 | # PCONF_PLATFORMS_INI): |
| 28 | # |
| 29 | PCONF_MAKEFILE_OUTPUT=$SRC_DIR/Makefile |
| 30 | |
| 31 | |
| 32 | # Referances to Platform Configurator's files: |
| 33 | # |
| 34 | |
| 35 | # Prefix directory: |
| 36 | PCONF_PREFIX=pconf |
| 37 | |
| 38 | # Generated pconf binary: |
| 39 | PCONF=$PCONF_PREFIX/pconf |
| 40 | |
| 41 | # Tempory variables (don't touch): |
| 42 | PCONF_NEED_COMPILE=1 |
| 43 | PCONF_GENERATE_SUCCESS=0 |
| 44 | |
| 45 | |
| 46 | # ############################################################################## |
| 47 | # |
| 48 | # No need to edit below this line |
| 49 | # |
| 50 | |
| 51 | # Special `reset' case |
| 52 | if [ "$1" = "--reset" ]; then |
| 53 | echo "Resetting Platform Configurator for a clean distribution..." |
| 54 | |
| 55 | # Remove generated pconf binary |
| 56 | if [ -f $PCONF ]; then |
| 57 | rm -v $PCONF |
| 58 | fi |
| 59 | |
| 60 | # Remove this platform information file |
| 61 | if [ -f $PCONF_THIS_PLATFORM_INI ]; then |
| 62 | rm -v $PCONF_THIS_PLATFORM_INI |
| 63 | fi |
| 64 | |
| 65 | # Remove generated pconf output Makefile |
| 66 | if [ -f $PCONF_MAKEFILE_OUTPUT ]; then |
| 67 | rm -v $PCONF_MAKEFILE_OUTPUT |
| 68 | fi |
| 69 | |
| 70 | echo "Done" |
| 71 | exit 0 |
| 72 | fi |
| 73 | |
| 74 | |
| 75 | # Has pconf been compiled for this system? |
| 76 | if [ -f $PCONF ]; then |
| 77 | PCONF_NEED_COMPILE=0 |
| 78 | fi |
| 79 | |
| 80 | # Need to generate (compile) pconf? |
| 81 | if [ $PCONF_NEED_COMPILE = "1" ]; then |
| 82 | echo "Collecting information about this platform..." |
| 83 | if [ -f $PCONF_THIS_PLATFORM_INI ]; then |
| 84 | rm $PCONF_THIS_PLATFORM_INI |
| 85 | fi |
| 86 | uname -s >> $PCONF_THIS_PLATFORM_INI |
| 87 | uname -r >> $PCONF_THIS_PLATFORM_INI |
| 88 | uname -m >> $PCONF_THIS_PLATFORM_INI |
| 89 | |
| 90 | echo "Generating Platform Configurator and testing system's compiler..." |
| 91 | cd $PCONF_PREFIX |
| 92 | make clean |
| 93 | make |
| 94 | cd .. |
| 95 | |
| 96 | # Check if generation successful |
| 97 | if [ -f $PCONF ]; then |
| 98 | PCONF_GENERATE_SUCCESS=1 |
| 99 | fi |
| 100 | if [ $PCONF_GENERATE_SUCCESS = "0" ]; then |
| 101 | echo "Could not generate Platform Configurator and/or compiler not functioning," |
| 102 | echo "you may not be able to compile/build any programs on this system. Please " |
| 103 | echo "review any errors encountered above and consult with vendors." |
| 104 | echo " " |
| 105 | exit 1 |
| 106 | fi |
| 107 | if [ $PCONF_GENERATE_SUCCESS = "1" ]; then |
| 108 | echo " " |
| 109 | echo "Compiler passed all compatibility tests!" |
| 110 | echo " " |
| 111 | fi |
| 112 | fi |
| 113 | |
| 114 | # Run pconf |
| 115 | if [ -f $PCONF ]; then |
| 116 | $PCONF $PCONF_PLATFORMS_INI "$@" |
| 117 | exit $? |
| 118 | fi |