convert_makefile_for_lcc - posix to lcc makefile converter (OBSOLETE)
tt = convert_makefile_for_lcc(MakeName)
- MakeName : string. path+name of the Makefile
- tt : vector of strings. text of the new Makefile file
function tt=convert_makefile_for_lcc(MakeName)
txt=mgetl(MakeName);
tt=[];
SCIDIR=strsubst(SCI,'/','\');
k=1
for j=1:size(txt,1)
//change scilab path
if strindex(txt(j),'SCIDIR =')<>[] then
tt(k)='SCIDIR = '+""""+SCIDIR+"""";
k=k+1;
end
//change MODNUM path
if strindex(txt(j),'MODNUMDIR =') <>[] then
tt(k)='MODNUMDIR = '+""""+MODNUMDIR+"""";
k=k+1;
end
//change OBJS extension
if strindex(txt(j),'OBJS =')<>[] then
tt(k)=strsubst(txt(j),'.o','.obj');
k=k+1
end
//change OBJSSTAN extension
if strindex(txt(j),'OBJSSTAN=')<>[] then
tt(k)=strsubst(txt(j),'.o','.obj');
k=k+1;
end
//change SCILIBS
if strindex(txt(j),'SCILIBS =')<>[] then
tt(k)='SCILIBS = '+""""+SCIDIR+"\bin\LibScilablcc.lib"""
k=k+1;
end
//change OTHERLIBS
if strindex(txt(j),'OTHERLIBS =')<>[] then
tt(k)=strsubst(txt(j),'/','\');
tt(k)=strsubst(tt(k),'.o','.obj');
k=k+1;
end
//change CFLAGS
if strindex(txt(j),'CFLAGS =')<>[] then
tt(k)='CFLAGS = -I""$(SCIDIR)\routines"" -I""$(SCIDIR)\routines\scicos"" -I""$(SCIDIR)\routines\sun"" -I""$(SCIDIR)\routines\f2c"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__'
k=k+1;
end
//copy LIBRARY line
if strindex(txt(j),'LIBRARY =')<>[] then
tt(k)=txt(j)
k=k+1;
end
end
//add line for lcc
tt(k)='CC = lcc'; k=k+1;
tt(k)='LINKER = lcclnk'; k=k+1;
tt(k)='LINKER_FLAGS = -dll -nounderscores';k=k+1;
tt(k)='DUMPEXTS = $(SCIDIR)\bin\dumpexts'; k=k+1;
//add line for making all
tt=[tt
''
'all :: $(LIBRARY).dll'
'$(LIBRARY).dll: $(OBJS)'
' @echo Creation of dll $(LIBRARY).dll and import lib from ...'
' @echo $(OBJS)'
' $(DUMPEXTS) -o ""$*.def"" ""$*.dll"" $(OBJS)'
' $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCILIBS) $(XLIBSBIN) $(TERMCAPLIB) $*.def -o $(LIBRARY).dll'
'c.obj:'
' @echo ------------- Compile file $< --------------'
' $(CC) $(CFLAGS) $< '
]
mputl(tt,MakeName+'.lcc');
endfunction
IRCOM Group
Alan Layec