current: all

PDSOURCE = /usr/local/src/pd-0.39-2/src

.SUFFIXES: .pd_linux

EXT = pd_linux

LDFLAGS = -export-dynamic -shared
LIB = -ldl -lm -lpthread

#select either the DBG and OPT compiler flags below:
CFLAGS = -DPD -DUNIX -W -Werror -Wno-unused \
	-Wno-parentheses -Wno-switch -O6 -funroll-loops -fomit-frame-pointer -fno-strict-aliasing \
	-DDL_OPEN -fPIC


INCLUDE = -I. -I$(PDSOURCE)

# the sources
SRC = $(sort $(filter %.c, $(wildcard *.c)))

OBJ = $(SRC:.c=.o) 

#
#  ------------------ targets ------------------------------------
#

clean:
	-rm ../../lib/$(TARGET).$(EXT) $(TARGET).$(EXT)
	-rm *.o

all: $(OBJ)
	@echo :: $(OBJ)
	ld $(LDFLAGS) -o $(TARGET).$(EXT) *.o $(LIB)
	strip --strip-unneeded $(TARGET).$(EXT)
	-cp $(TARGET).$(EXT) ../../lib

$(OBJ) : %.o : %.c
	touch $*.c
	cc $(CFLAGS) $(INCLUDE) -c -o $*.o $*.c