File: Makemexcpp

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (129 lines) | stat: -rw-r--r-- 3,610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Generated automatically from Makefile.in by configure.
SHELL = /bin/sh


#******************************************************************* 
# A rajouter ds Makefile.incl.in pour que le configure de  libtool nous le 
# donne

top_builddir = $(SCIDIR)
DLLTOOL = 
LD = ld
LIBM = 
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIBTOOL_DEPS = config/ltconfig config/ltmain.sh
LN_S = ln -s
NM = /usr/bin/nm -B
OBJDUMP = 
RANLIB = ranlib
STATIC = 
CC = gcc
CPP = g++
CPPFLAGS = 
LDFLAGS = -lstdc++
LIBS = 	-ltclsub -lg++ -lstdc++ -lgcc -lX11  -lm -lc 

INCLUDES= -I$(SCIDIR)/routines 
CFLAGS = $(CC_OPTIONS) $(CC_PICFLAGS) 
COMPILE = $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
CPPCOMPILE = $(CPP) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LTCPPCOMPILE = $(LIBTOOL) --mode=compile $(CPP) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@

OBJECTS = $(MEXOBJECTS:.o=.lo) $(LIBRARY)_gateway.lo $(OTHEROBJECTS:.o=.lo)
MEXOBJECTS = $(MEXSOURCES:.cpp=.o)
OTHEROBJECTS = $(OTHERSOURCES:.cpp=.o)
FUNCTIONS = $(MEXNAMES)
#******************************************************************* 

all::  CLEAROLD GATEWAYS $(OTHEROBJECTS) $(LIBRARY)_gateway.lo $(LIBRARY).la $(LIBRARY).sce 

.SUFFIXES:
.SUFFIXES: .c .lo .o .f .cpp

$(LIBRARY).la : $(OBJECTS) 
	@$(LINK) -rpath `pwd` -module -avoid-version -export-dynamic $(OBJECTS);
	@$(LIBTOOL) --mode=install cp $(LIBRARY).la `pwd`/$(LIBRARY).la 

.c.o:
	@$(COMPILE) -c $<

.c.lo:
	@$(LTCOMPILE) -c $<

.cpp.o:
	@$(CPPCOMPILE) -c $<

.cpp.lo :
	@$(LTCPPCOMPILE) -c $<


$(LIBRARY)_gateway.c: 
	@echo "-- Generating the C function $(LIBRARY)_gateway.c";
	@echo "#include \"mex.h\" " > $(LIBRARY)_gateway.c;
	@for i in $(FUNCTIONS) ;\
	do (\
	echo "extern Gatefunc mex_$$i;" >> $(LIBRARY)_gateway.c; \
	); \
	done
	@echo "static GenericTable Tab[]={" >> $(LIBRARY)_gateway.c;
	@for i in $(FUNCTIONS) ;\
	do (\
	echo "{mex_gateway, mex_$$i , \"error msg\"}," >> $(LIBRARY)_gateway.c; \
	); \
	done
	@echo "	 };" >> $(LIBRARY)_gateway.c;
	@echo "int C2F($(LIBRARY)_gateway)()" >> $(LIBRARY)_gateway.c;
	@echo "{  Rhs = Max(0, Rhs);" >> $(LIBRARY)_gateway.c;
	@echo "(*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);" >> $(LIBRARY)_gateway.c;
	@echo "  return 0;" >> $(LIBRARY)_gateway.c;
	@echo "}" >> $(LIBRARY)_gateway.c;
	@rm -f  $(LIBRARY)_gateway.o ;

$(LIBRARY).sce:
	@echo "-- Generating the Scilab script $(LIBRARY).sce";
	@echo "scilab_functions =[..." >> script;
	@for i in $(FUNCTIONS) ;\
	do (\
	echo "                  \"$$i\"; " >> script; \
	); \
	done
	@echo "           ];" >> script;
	@echo "addinter(\"$(LIBRARY).so\",\"$(LIBRARY)_gateway\",scilab_functions);" >> script;
	@mv script $(LIBRARY).sce; 
	@rm -f script;
	@echo "------------------------------------------";
	@echo "To load $(FUNCTIONS)";
	@echo "        functions, at Scilab prompt, enter:";
	@echo "-->exec $(LIBRARY).sce";
	@echo "------------------------------------------";
	@echo "Don't forget: ";
	@echo "LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH";
	@echo "or";
	@echo "setenv LD_LIBRARY_PATH `pwd`";

clean	::
	$(RM) *.o *.lo
	rm -f $(LIBRARY).sce
	rm -f $(LIBRARY)_gateway.c
	rm -f $(LIBRARY).la
	rm -f $(LIBRARY).so
	rm -f -r .libs

distclean:: clean 
	$(RM) -f -r .libs  $(LIBRARY).*
	rm -f $(LIBRARY).sce
	rm -f $(LIBRARY)_gateway.c

$(LIBRARY)_gateway.lo: $(LIBRARY)_gateway.c
	@$(LTCOMPILE) -c $(LIBRARY)_gateway.c


GATEWAYS: $(MEXOURCES)
	@./compilemex.sh '$(MEXSOURCES)' '$(MEXNAMES)' '$(LTCPPCOMPILE)'

CLEAROLD:
	rm -f $(LIBRARY).sce
	rm -f $(LIBRARY)_gateway.c