NAME=roughometer
CSYM=roughometer

current: pd_nt pd_linux pd_darwin
#
# To compile: delete the .pd_darwin and type make pd_darwin
# ----------------------- Mac OSX -----------------------

pd_darwin: $(NAME).pd_darwin

.SUFFIXES: .pd_darwin
# -fast -ffast-math 
DARWININCLUDE =  -I/Applications/Pd-extended.app/Contents/Resources/include 
DARWINCFLAGS = -O2 -DPD -Wall -W -Wshadow -Wstrict-prototypes \
    -Wno-unused -Wno-parentheses -Wno-switch -m32

.c.pd_darwin:
	#mv *.pd_darwin *.pd_darwin~
	cc $(DARWINCFLAGS) $(DARWININCLUDE) -o $*.o -c $*.c
	cc -bundle -undefined suppress -flat_namespace -o $*.pd_darwin $*.o -arch i386
	rm -f $*.o

#-------Documentation-----
doc:
	/Applications/Doxygen.app/Contents/Resources/doxygen Doxyfile.cnf
	/usr/local/bin/astyle/astyle --style=java --suffix=none --errors-to-stdout *.c *.h
# ----------------------- NT -----------------------

pd_nt: $(NAME).dll

.SUFFIXES: .dll

PDNTCFLAGS = /W3 /WX /O2 /DNT /DPD /nologo

# where is VC++ ???
VC="C:\Program Files\Microsoft Visual Studio 8\VC"

# where is your m_pd.h ???
PDNTINCLUDE = /I. /I"C:\Program Files\pd\tcl\include" /I"C:\Program Files\pd\src" /I$(VC)\include /Iinclude
PDNTLDIR = $(VC)\lib
#PDNTLIB = $(PDNTLDIR)\libc.lib \        
#            $(PDNTLDIR)\user32.lib \
#            $(PDNTLDIR)\uuid.lib \
PDNTLIB =    $(PDNTLDIR)\kernel32.lib \
             $(PDNTLDIR)\oldnames.lib \
             $(PDNTLDIR)\LIBCMT.lib \
             "C:\Program Files\pd\bin\pd.lib" \

.c.dll:
	cl $(PDNTCFLAGS) $(PDNTINCLUDE) /c $*.c
	link /dll /export:$(CSYM)_setup $*.obj $(PDNTLIB)
# ----------------------------------------------------------

install:
	cp help-*.pd ../../doc/5.reference

clean:
	rm -f *.o *.pd_* so_locations
