This is the mail archive of the
cygwin
mailing list for the Cygwin project.
makefile for matlab-engine in cygwin
- From: z3259989 at student dot unsw dot edu dot au
- To: cygwin at cygwin dot com
- Date: Wed, 21 May 2008 15:53:01 +1000
- Subject: makefile for matlab-engine in cygwin
- Messageid: <200805210553.m4L5r2no009959@steeljaw.comms.unsw.edu.au>
- Resent-messageid: <200805210553.m4L5r2no009959@steeljaw.comms.unsw.edu.au>
Hi evereybody
I am working with a client/server system and I am trying to extend it with an
input client which uses matlab engine to get data from matlab.
I would like to compile it with cygwin in windows XP.
Just typing 'mex.bat A.c B.c' (where 'A.c' and 'B.c' are a 'reduced' version of
the input client) in the cygwin bash shell works fine, but I am a bit
struggling with the makefile:
I would like to extend an existing makefile which works fine with other input
clients.
If I just change 'gcc' to 'mex.bat' in the makefile I get the following error:
$ make
Makefile:34: depend: No such file or directory
mex.bat -M -g -O3 -std=c99 -Wall -W -Werror -pedantic -I../../server -
I../../utility file.c file_input.c flight_info.c input_client.c main.c
matlab_flightpath_input.c orientation.c parse_arg.c pdf.c position.c
time_stamp.c ../../utility/file.c ../../utility/tcp.c ../../utility/parse_arg.c
./../server/flight_info.c ../../server/pdf.c ../../server/position.c ../../serv
er/time_stamp.c ../../server/o
rientation.c ../../server/input_client.c ../../server/client.c > depend
make: [depend] Error 9 (ignored)
depend:2: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
I am a pretty newbie concerning compiling and linking, but I think there is a
linking problem when using 'mex.bat'.
I am using
cygwin version 1.5.24-2
gcc version 3.4.4-3
matlab R2007b
Appendix 1: makefile
###############################################
CC = gcc
UTILITY_DIR = ../../utility
SERVER_DIR = ../../server
WARNFLAGS = -Wall -W -Werror -pedantic
CFLAGS = -g -O3 -std=c99 $(WARNFLAGS) -I$(SERVER_DIR) -I$(UTILITY_DIR)
PROG = program_name
UTILITY_CFILES = ufiles.c
SERVER_CFILES = sfiles.c
MAIN_CFILES = $(wildcard *.c)
CFILES = $(MAIN_CFILES) $(patsubst %,$(UTILITY_DIR)/%,$(UTILITY_CFILES))
$(patsubst %,$(SERVER_DIR)/%,$(SERVER_CFILES))
OBJS = $(CFILES:.c=.o)
.PHONY: all run clean clear mkdepend
all: $(PROG)
$(PROG): $(OBJS)
$(CC) $(OBJS) -o $(PROG)
run: all
./$(PROG)
valgrind: all
valgrind --leak-check=full --suppressions=suppressions ./$(PROG)
clean:
-rm $(OBJS) $(PROG) depend
depend:
-$(CC) -M $(CFLAGS) $(CFILES) > depend
mkdepend:
-rm -f depend
-$(MAKE) depend
include depend
################################################
Appendix 2: mexopts.bat file
@echo off
rem LCCENGMATOPTS.BAT
rem
rem Compile and link options used for building standalone engine or MAT
rem programs
rem with LCC C compiler 2.4
rem
rem $Revision: 1.5.4.1 $ $Date: 2006/06/23 19:04:42 $
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************
set MATLAB=%MATLAB%
set PATH=%MATLAB%\sys\lcc\bin;%PATH%
set LCCMEX=%MATLAB%\sys\lcc\mex
set PERL="%MATLAB%\sys\perl\win32\bin\perl.exe"
set MW_TARGET_ARCH=win32
rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=lcc
set OPTIMFLAGS=-DNDEBUG
set DEBUGFLAGS=-g4
set COMPFLAGS=-c -Zp8 -I"%MATLAB%\sys\lcc\include" -noregistrylookup
set NAME_OBJECT=-Fo
rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\lcc
set LINKER=lcclnk
set LINKFLAGS=-tmpdir "%OUTDIR%." -L"%MATLAB%\sys\lcc\lib" -libpath "%LIBLOC%"
set LINKFLAGSPOST=libmx.lib libmat.lib libeng.lib
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=-o "%OUTDIR%%MEX_NAME%.exe"
set RSP_FILE_INDICATOR=@
rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=
set RC_LINKER=
Any help or pointers in the right direction would be highly appreciated.
Fabian
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/