Merge branch 'master' of ssh://git.code.sf.net/p/feistymeow/trunk into dev
[feisty_meow.git] / scripts / clam / cpp / postconditions.sh
1 #!/bin/bash
2 # copies the final products of the current project into the repository.
3
4 # promote nothing from the built objects if this is a cleanup.
5 if [ ! -z "$CLEAN" ]; then
6   exit 0
7 fi
8
9 # check whether a failure should prevent promotion from occurring.
10 if [ -f $FAILURE_FILE ]; then
11   echo Postconditions will not promote due to a failure:
12   cat $FAILURE_FILE
13   . $CLAM_SCRIPTS/exit_make.sh
14 fi
15
16 # make sure that we actually did something during the make.
17 if [ ! -f "$DIRTY_FILE" -a ! -f "$SUBMAKE_FLAG" ]; then
18   # nothing was built, seemingly, so we do no promotion.
19   exit
20 fi
21
22 # clean up generated resource files after the build.
23 for i in *.resources; do rm -f "$i"; done
24
25 # causes the shell to quit.
26 DIE="source $CLAM_SCRIPTS/exit_make.sh"
27
28 if [ ! -d $TARGETS_STORE ]; then mkdir -p $TARGETS_STORE; fi
29
30 if [ "$TYPE" = "library" ]; then
31
32   # make sure the required directories exist.
33   if [ ! -d $STATIC_LIBRARY_DIR ]; then mkdir -p $STATIC_LIBRARY_DIR; fi
34   if [ ! -d $DYNAMIC_LIBRARY_DIR ]; then mkdir -p $DYNAMIC_LIBRARY_DIR; fi
35
36 elif [[ "$TYPE" == "application" || "$TYPE" == "test" ]]; then
37
38   # sets up the directory for executable programs and copies any found in the
39   # this project's final directory.
40
41   # first make sure the executable directory is around.
42   if [ ! -d $EXECUTABLE_DIR ]; then mkdir -p $EXECUTABLE_DIR; fi
43
44   if [ -z "$NO_COMPILE" ]; then
45     # we ensure that none of the normal products are copied for a non-compiling
46     # style of project.
47
48     # copy anything extra over.
49     if [ ! -z "$EXTRA_COPIES" ]; then
50       echo Copying extra files to $EXECUTABLE_DIR.
51       echo [$EXTRA_COPIES]
52       cp -f $EXTRA_COPIES $EXECUTABLE_DIR || $DIE
53     fi
54
55   fi
56
57 elif [ "$TYPE" = "hierarchy" ]; then
58
59   # do nothing.
60   echo "Done with $PROJECT";
61
62 else
63   echo "Unknown type for project [$TYPE]; cancelling postconditions!"
64   source $CLAM_SCRIPTS/exit_make.sh
65 fi
66