Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
5e9eec4271bc20c8434655c15791200d2cbd6bf3
[simgrid.git] / src / smpi / smpicc.in
1 #! /bin/sh
2
3 CC=@CMAKE_C_COMPILER@
4
5 INCLUDEARGS="@includeflag@"
6 CMAKE_LINKARGS="-L@libdir@"
7
8 @SMPITOOLS_SH@
9
10 list_set CFLAGS
11 list_set LINKARGS
12 if [ "@WIN32@" != "1" ]; then
13     list_add CFLAGS "-Dmain=smpi_simulated_main_"
14     list_add LINKARGS "-lsimgrid"
15 else
16     list_add CFLAGS "-include" "@includedir@/smpi/smpi_main.h"
17     list_add LINKARGS "@libdir@\libsimgrid.dll"
18 fi
19
20 list_set CMDLINE
21 while [ $# -gt 0 ]; do
22     ARG="$1"
23     shift
24     case "${ARG}" in
25         -c)
26             CMAKE_LINKARGS=""
27             LINKARGS=""
28             list_add CMDLINE "-c"
29             ;;
30         *.c)
31             SRCFILE="$(readlink -f ${ARG} 2>/dev/null)"
32             if [ -z "$SRCFILE" ] ; then
33                 SRCFILE="$ARG"
34             fi
35             list_add CMDLINE "${SRCFILE}"
36             ;;
37         *)
38             list_add CMDLINE "${ARG}"
39       ;;
40   esac
41 done
42
43 list_set CMDLINE "${CFLAGS}" "${CMDLINE}" ${INCLUDEARGS} ${CMAKE_LINKARGS} "${LINKARGS}"
44 eval $(list_get CMDLINE)
45
46 "${CC}" "$@"