[2] | 1 | # This file is part of MKF. |
---|
| 2 | # |
---|
| 3 | # MKF is free software; you can redistribute it and/or modify |
---|
| 4 | # it under the terms of the GNU General Public License as published by |
---|
| 5 | # the Free Software Foundation; either version 2 of the License, or |
---|
| 6 | # (at your option) any later version. |
---|
| 7 | # |
---|
| 8 | # MKF is distributed in the hope that it will be useful, |
---|
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 11 | # GNU General Public License for more details. |
---|
| 12 | # |
---|
| 13 | # You should have received a copy of the GNU General Public License |
---|
| 14 | # along with MKF; if not, write to the Free Software |
---|
| 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 16 | # |
---|
| 17 | # Copyright (c) 2004 Alexandre Becoulet <alexandre.becoulet@epita.fr> |
---|
| 18 | |
---|
| 19 | # static lib archiver invocation |
---|
| 20 | _if_var_eq cmd_linker |
---|
| 21 | var_define cmd_linker ld |
---|
| 22 | _end_if |
---|
| 23 | |
---|
| 24 | _if_var_eq use_linker |
---|
| 25 | |
---|
| 26 | _if_in_path {PVAR,cmd_linker} |
---|
| 27 | |
---|
| 28 | _if_stdout_match GNU {PVAR,cmd_linker} -V |
---|
| 29 | msg_info GNU linker found ({PVAR,cmd_linker}) |
---|
| 30 | var_define use_linker gnu |
---|
| 31 | _else |
---|
| 32 | |
---|
| 33 | _if_stdout_match Solaris {PVAR,cmd_linker} -V |
---|
| 34 | msg_info Solaris linker found ({PVAR,cmd_linker}) |
---|
| 35 | var_define use_linker solaris |
---|
| 36 | _else |
---|
| 37 | |
---|
| 38 | msg_info unknown linker found ({PVAR,cmd_linker}) |
---|
| 39 | var_define use_linker ld |
---|
| 40 | _end_if |
---|
| 41 | _end_if |
---|
| 42 | |
---|
| 43 | _else |
---|
| 44 | msg_error no linker found |
---|
| 45 | _end_if |
---|
| 46 | |
---|
| 47 | _end_if |
---|
| 48 | |
---|
| 49 | # object merge link |
---|
| 50 | |
---|
| 51 | _if_var_eq mkf_pretty_print yes |
---|
| 52 | command_add o o @echo " LD (partial .o) {OUT}" |
---|
| 53 | _end_if |
---|
| 54 | command_add o o {PVAR,cmd_linker} -r {JVAR,opt_o_linker} -o {OUT} {SRC,.*\.o} |
---|
| 55 | |
---|
| 56 | # dynamic lib linker invocation |
---|
| 57 | _if_var_eq use_linker solaris |
---|
| 58 | msg_info using ld -G for dynamic library generation |
---|
| 59 | var_append opt_so_linker -G |
---|
| 60 | _else |
---|
| 61 | msg_info using ld -shared for dynamic library generation |
---|
| 62 | var_append opt_so_linker -shared |
---|
| 63 | _end_if |
---|
| 64 | |
---|
| 65 | _if_var_eq static yes |
---|
| 66 | var_append opt_exe_linker -static |
---|
| 67 | _end_if |
---|
| 68 | |
---|
| 69 | _if_var_eq mkf_pretty_print yes |
---|
| 70 | command_add o so @echo " LD (shared .so) {OUT}" |
---|
| 71 | _end_if |
---|
| 72 | command_add o so {PVAR,cmd_linker} {JVAR,opt_so_linker} -o {OUT} {SRC,.*\.o} {JLIST,-l,_libs} {JLIST,-l,libs} |
---|
| 73 | |
---|
| 74 | _if_var_eq mkf_pretty_print yes |
---|
| 75 | command_add o noext @echo " CC (exe linking) {OUT}" |
---|
| 76 | _end_if |
---|
| 77 | command_add o noext {JVAR,cmd_c_compiler} {JVAR,opt_exe_linker} \ |
---|
| 78 | -o {OUT} {SRC,.*\.o} {JLIST,-L,lib_dirs} {JLIST,-l,_libs} {JLIST,-l,libs} |
---|
| 79 | |
---|
| 80 | _if_var_eq mkf_pretty_print yes |
---|
| 81 | command_add o a @echo " AR {OUT}" |
---|
| 82 | _end_if |
---|
| 83 | command_add o a ar -rc {OUT} {SRC,.*\.o} |
---|
| 84 | |
---|
| 85 | _if_var_eq mkf_pretty_print yes |
---|
| 86 | command_add o a @echo " RANLIB {OUT}" |
---|
| 87 | _end_if |
---|
| 88 | command_add o a ranlib {OUT} |
---|
| 89 | |
---|