# Compiler/linker setup ------------------------------------------------------

# Mac OS X-specific flags.  Comment these out if using Linux.
#PLATFORM = osx
#CC       = gcc
#CFLAGS   = -fast -Wall
#OSLIBS   = -Wl,-framework -Wl,IOKit
#LDFLAGS  =

# Linux-specific flags.  Comment these out if using Mac OS X.
PLATFORM = linux
CC       = gcc
CFLAGS   = -O3 -Wall
OSLIBS   =
LDFLAGS  =

# make all: all OBJS are compiled and executable available
# make <individual>
# make clean
# -lpthread does not work when put into CFLAGS, only at the end of the command (like -lm for math.h)
# do not use spaces (tabs are allowed)
# Example programs -----------------------------------------------------------

OBJS = conv2m conv2m_pthreads
all: $(OBJS)

conv2m: conv2m.c conv2m_fun.o
	$(CC) $(CFLAGS) -o conv2m conv2m.c conv2m_fun.o

conv2m_pthreads: conv2m_pthreads.c conv2m_fun.o
	$(CC) $(CFLAGS) -o conv2m_pthreads conv2m_pthreads.c conv2m_fun.o -lpthread

# library
conv2m_fun.o: conv2m_fun.c conv2m_fun.h
	$(CC) $(CFLAGS) -c conv2m_fun.c # -o mat_fun.o --> seems implied here when using 'func.o' as label

# Maintenance and stuff ------------------------------------------------------
clean:
	rm -f $(OBJS) *.o core
