aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile63
-rw-r--r--Makefile.config25
2 files changed, 54 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 93b013c..86f3599 100644
--- a/Makefile
+++ b/Makefile
@@ -1,16 +1,61 @@
-current: all
+PD_DIR = ../../pd
+PDP_DIR = ../pdp
-include Makefile.config
+GEM_OPENCV_VERSION = 0.1
-PDP_MOD = pdp_opencv_threshold.o pdp_opencv_edge.o pdp_opencv_distrans.o pdp_opencv_laplace.o pdp_opencv_motempl.o pdp_opencv_morphology.o pdp_opencv_haarcascade.o pdp_opencv_contours_convexity.o pdp_opencv_contours_boundingrect.o pdp_opencv_bgsubstract.o pdp_opencv_lk.o pdp_opencv_floodfill.o pdp_opencv.o
+# build flags
+INCLUDES = -I$(PD_DIR)/src -I. -I$(PDP_DIR)/include -I$(PD_DIR)/src
+CPPFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -ffast-math \
+ -Wall -W -Wno-unused -Wno-parentheses -Wno-switch \
+ -DGEM_OPENCV_VERSION=\"$(GEM_OPENCV_VERSION)\" -g
-# build basic image processing modules (derived from base class)
-all: $(PDP_MOD)
- $(CC) -export_dynamic -shared -o pdp_opencv.pd_linux *.o $(PDP_LIBS) `pkg-config --cflags --libs opencv`
+
+UNAME := $(shell uname -s)
+ifeq ($(UNAME),Linux)
+ INCLUDES += `pkg-config --cflags opencv`
+ LDFLAGS = -export_dynamic -shared
+ LIBS = `pkg-config --libs opencv`
+ EXTENSION = pd_linux
+endif
+ifeq ($(UNAME),Darwin)
+ OPENCV_DIR = ../pix_opencv/opencv-1.0.0
+ INCLUDES += -I$(OPENCV_DIR)/cv/include -I$(OPENCV_DIR)/cxcore/include -I$(OPENCV_DIR)/cvaux/include -I/sw/include
+ LDFLAGS = -bundle -undefined dynamic_lookup
+ LIBS = -lm $(OPENCV_DIR)/build/cv/src/.libs/lib_cv.a -L/sw/lib
+ EXTENSION = pd_darwin
+endif
+ifeq (MINGW,$(findstring MINGW,$(UNAME)))
+ OPENCV_DIR = opencv-1.0.0
+ INCLUDES += -I$(OPENCV_DIR)/cv/include -I$(OPENCV_DIR)/cxcore/include -I$(OPENCV_DIR)/cvaux/include
+ CPPFLAGS += -mms-bitfields -DMSW -DNT $(WINDOWS_HACKS)
+ LDFLAGS += -shared
+ LIBS = -L$(pd_src)/bin -L$(pd_src)/obj -lpd -lkernel32 -luser32 -lgdi32 \
+ -lm $(OPENCV_DIR)/build/cv/src/.libs/lib_cv.a
+endif
+
+.SUFFIXES = $(EXTENSION)
+
+SOURCES = pdp_opencv_threshold.c pdp_opencv_edge.c pdp_opencv_distrans.c pdp_opencv_laplace.c pdp_opencv_motempl.c pdp_opencv_morphology.c pdp_opencv_haarcascade.c pdp_opencv_contours_convexity.c pdp_opencv_contours_boundingrect.c pdp_opencv_bgsubstract.c pdp_opencv_lk.c pdp_opencv_floodfill.c
+
+all: $(SOURCES:.c=.$(EXTENSION))
+
+%.$(EXTENSION): %.o
+ gcc $(LDFLAGS) -o $*.$(EXTENSION) $*.o $(LIBS)
+
+.cc.o:
+ g++ $(CPPFLAGS) $(INCLUDES) -o $*.o -c $*.cc
+
+.c.o:
+ gcc $(CPPFLAGS) $(INCLUDES) -o $*.o -c $*.c
+
+install:
+ cp -f --remove-destination *.pd $(PD_DIR)/doc/5.reference
clean:
- rm -f *~
- rm -f *.o
- rm -f *.pd_linux
+ rm -f pix_opencv*.o
+ rm -f pix_opencv*.$(EXTENSION)
+
+distro: clean all
+ rm *.o
diff --git a/Makefile.config b/Makefile.config
deleted file mode 100644
index 0273e28..0000000
--- a/Makefile.config
+++ /dev/null
@@ -1,25 +0,0 @@
-# if configure can't find the m_pd.h header
-# specify pd's include path here and ignore the warning
-#
-OPENCV_CPPFLAGS=-I/usr/include/opencv/
-PD_CPPFLAGS=-I/usr/src/pd-0.40-2/src
-PDP_CFLAGS=-I/usr/src/pdp-0.12.5-test-7/include -DPD -Wall -W -Wstrict-prototypes -Wno-unused -Wno-parentheses -Wno-switch -O2 -funroll-loops -fomit-frame-pointer -ffast-math -freg-struct-return -DLINUX
-
-prefix=/usr/local
-PDP_CV_VERSION = 0.0.1
-PDP_TARGET = linux
-PDP_LIBRARY_NAME = pdp_opencv.pd_linux
-
-PDP_CPPFLAGS = -I. -I/usr/X11R6/include -I../include -I../../include $(PD_CPPFLAGS) $(OPENCV_CPPFLAGS)
-#--gstabs
-
-PDP_CFLAGS += -DPDP_CV_VERSION=\"$(PDP_CV_VERSION)\"
-
-CC = gcc
-
-# build rules
-
-.c.o:
- $(CC) $(PDP_CFLAGS) $(PDP_CPPFLAGS) -o $*.o -c $*.c
-.s.o:
- $(AS) -o $*.o $*.s $(PDP_AFLAGS) `pkg-config --cflags --libs opencv`