
# Set the MATLAB_ROOT properly,
#   so that the header files and library files can be found.
# Normally, set it to the decompression folder used in mglinstaller.
MATLAB_ROOT=$(HOME)/test

# Set Matlab directory information
MATLAB_INCL_DIR = -I$(MATLAB_ROOT)/include/
MATLAB_LIB_DIR = -L$(MATLAB_ROOT)/bin/glnx86

LIBS = -lmatpp -lmmfile -lmatlb -lmat -lmx -lnsl -lm
LDLIBS = $(MATLAB_LIB_DIR) $(LIBS)

# For c_math library, ok to use latest gcc
CC = gcc 
CFLAGS = -g  -Wall

RM =rm -f

all: ex1 ex2 ex3 ex4 ex5 ex6

ex1:  
	$(CC) $(CFLAGS) $(MATLAB_INCL_DIR) $(LDLIBS) -o ex1 ex1.c 

ex2:  
	$(CC) $(CFLAGS) $(MATLAB_INCL_DIR) $(LDLIBS) -o ex2 ex2.c 
	
ex3:  
	$(CC) $(CFLAGS) $(MATLAB_INCL_DIR) $(LDLIBS) -o ex3 ex3.c 
	
ex4:  
	$(CC) $(CFLAGS) $(MATLAB_INCL_DIR) $(LDLIBS) -o ex4 ex4.c 
	
ex5:  
	$(CC) $(CFLAGS) $(MATLAB_INCL_DIR) $(LDLIBS) -o ex5 ex5.c 
	
ex6:  
	$(CC) $(CFLAGS) $(MATLAB_INCL_DIR) $(LDLIBS) -o ex6 ex6.c 
	

.PHONY: clean

clean:
	$(RM) *.o ex?
