006aa97bb58fb966bd1fdf61795e31e8682d9ea3
[scilab.git] / scilab / modules / linear_algebra / examples / Makefile.mak
1 SCIDIR =../../..
2 SCIDIR1 =..\..\..
3
4 #LIBRARY = name of the dll (without .dll postfix)..
5 LIBRARY=lapackscilab
6
7 #########################################################################
8 #    To each .obj interface (C or Fortran) associate one scilab function
9 #    
10 CINTERFACES = intdgemm.obj intdlassq.obj intdgetrf.obj intdsyev.obj intdgeesx.obj intzgemm.obj intdgesvd.obj #intzgeesx.obj
11
12 CFUNCTIONS = dgemm dlassq dgetrf  dsyev dgeesx zgemm dgesvd #zgeesx
13
14 OTHERCOBJS = 
15
16 FORTRANINTERFACES = intfdgemm.obj inttestdgebal.obj intdgebak.obj intdgels.obj intdgeqrf.obj
17
18 FFUNCTIONS = fdgemm xxdgebal dgebak dgels dgeqrf 
19
20
21 OTHERFOBJS = 
22 ################ do not edit below this line #############################
23 DUMPEXTS="$(SCIDIR1)\bin\dumpexts"
24 SCIIMPLIB="$(SCIDIR1)\bin\LibScilab.lib"
25
26 !include ..\..\..\Makefile.incl.mak
27
28 FFLAGS = $(FC_OPTIONS) -DFORDLL -I"$(SCIDIR1)\routines"
29 CFLAGS = $(CC_OPTIONS) -DFORDLL -I"$(SCIDIR)/routines"
30
31 FUNCTIONS = $(CFUNCTIONS) $(FFUNCTIONS)
32
33 OBJSF = $(FORTRANINTERFACES) $(OTHERFOBJS)
34
35 OBJSC = $(CINTERFACES) $(OTHERCOBJS)
36
37 all::  $(OTHEROBJECTS) $(LIBRARY)_gateway.c $(LIBRARY)_gateway.obj $(LIBRARY).dll $(LIBRARY).sce message
38
39 OBJS = $(OBJSF) $(OBJSC) $(OTHEROBJECTS) $(LIBRARY)_gateway.obj
40
41 CLEAROLD:
42         @$(RM) $(LIBRARY).sce
43         @$(RM) $(LIBRARY)_gateway.c
44
45 $(LIBRARY)_gateway.c:
46         @echo "-- Generating the C function $(LIBRARY)_gateway.c";
47         @echo #include "mex.h"  > $(LIBRARY)_gateway.c
48         @echo /*  */ >> $(LIBRARY)_gateway.c
49         @"$(SCIDIR1)\tools\tomake\Tomake" @<< @<< @<<
50 extern Gatefunc %s;\n
51 <<
52 $(CINTERFACES:.obj=)
53 <<
54 $(LIBRARY)_gateway.c
55 <<
56         @"$(SCIDIR1)\tools\tomake\Tomake" @<< @<< @<<
57 extern Gatefunc C2F(%s);\n
58 <<
59 $(FORTRANINTERFACES:.obj=)
60 <<
61 $(LIBRARY)_gateway.c
62 <<
63         @echo /*  */ >> $(LIBRARY)_gateway.c
64         @echo static GenericTable Tab[]={  >> $(LIBRARY)_gateway.c
65         @"$(SCIDIR1)\tools\tomake\Tomake" @<< @<< @<<
66 {(Myinterfun)sci_gateway, %s,"error_msg"},\n
67 <<
68 $(CINTERFACES:.obj=)
69 <<
70 $(LIBRARY)_gateway.c
71 <<
72         @"$(SCIDIR1)\tools\tomake\Tomake" @<< @<< @<<
73 {(Myinterfun)sci_gateway, C2F(%s),"error_msg"},\n
74 <<
75 $(FORTRANINTERFACES:.obj=)
76 <<
77 $(LIBRARY)_gateway.c
78 <<
79         @echo    }; >> $(LIBRARY)_gateway.c
80         @echo /*   */ >> $(LIBRARY)_gateway.c
81         @echo int C2F($(LIBRARY)_gateway)() >> $(LIBRARY)_gateway.c
82         @echo {  Rhs = Max(0, Rhs); >> $(LIBRARY)_gateway.c
83         @echo (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F); >>  $(LIBRARY)_gateway.c
84         @echo   return 0; >> $(LIBRARY)_gateway.c
85         @echo } >>  $(LIBRARY)_gateway.c
86         @echo /*   */ >> $(LIBRARY)_gateway.c
87
88 $(LIBRARY).sce:
89         @echo -- Generating the Scilab script $(LIBRARY).sce;
90         @echo scilab_functions =[... > $(LIBRARY).sce
91         @"$(SCIDIR1)\tools\tomake\Tomake" @<< @<< @<<
92 "%s";\n
93 <<
94 $(FUNCTIONS)
95 <<
96 $(LIBRARY).sce
97 <<
98         @echo            ]; >> $(LIBRARY).sce
99         @echo files=G_make("void(Unix)","$(LIBRARY).dll"); >> $(LIBRARY).sce
100         @echo addinter(files,"$(LIBRARY)_gateway",scilab_functions); >> $(LIBRARY).sce
101
102 message:
103         @echo ------------------------------------------
104         @echo - To load function(s)
105         @echo         $(FUNCTIONS), 
106         @echo - at Scilab prompt, enter:
107         @echo "-->exec $(LIBRARY).sce;"
108         @echo ------------------------------------------
109
110 clean   ::
111         @$(RM) *.dia
112         @$(RM) *.obj
113         @$(RM) $(LIBRARY).sce
114         @$(RM) $(LIBRARY)_gateway.c
115         @$(RM) $(LIBRARY).lib
116         @$(RM) *.dll
117         @$(RM) *.def
118         @$(RM) *.lib
119         @$(RM) *.exp
120         @$(RM) *.pdb
121
122 distclean::     clean
123
124 tests:: 
125   @"$(SCIDIR1)\bin\scilex.exe" -nwni -nb -e scitest('lapackscilab.tst',%t);quit; 
126
127 $(LIBRARY).dll: $(OBJS)
128         @echo Creation of dll $(LIBRARY).dll and import lib from ...
129         @echo $(OBJS)
130         @$(DUMPEXTS) -o "$*.def" "$*.dll" $**
131         @echo $(LINKER) $(LINKER_FLAGS) $(OBJS) $(SCIIMPLIB) $(XLIBSBIN) $(TERMCAPLIB) /nologo /dll /out:"$*.dll" /implib:"$*.lib" /def:"$*.def" 
132         @$(LINKER) $(LINKER_FLAGS) $(OBJS) $(SCIIMPLIB) $(XLIBSBIN) $(TERMCAPLIB) /nologo /dll /out:"$*.dll" /implib:"$*.lib" /def:"$*.def" 
133         
134