From 6f2cc9fa9cb5a2fa615b3722d326748af98222fb Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 30 Jun 2008 20:50:46 +0000 Subject: fixed up Makefile to build on Mac OS X, and hopefully still on GNU/Linux svn path=/trunk/externals/pix_opencv/; revision=10122 --- Makefile | 83 ++++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 36 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b255ea1..1dd02a1 100644 --- a/Makefile +++ b/Makefile @@ -1,65 +1,76 @@ -PD_DIR = /usr/src/pd-0.40-2 -GEM_DIR = /usr/src/Gem +PD_DIR = ../../pd +GEM_DIR = ../../Gem +OPENCV_DIR = opencv-1.0.0 -LIBS = -lm +LIBS = -lm $(OPENCV_DIR)/build/cv/src/.libs/lib_cv.a GEM_OPENCV_VERSION = 0.1 # build flags -GEM_OPENCV_INCLUDE = -I$(PD_DIR)/src -I. -I$(GEM_DIR)/src -I$(PD_DIR)/src +GEM_OPENCV_INCLUDE = -I$(PD_DIR)/src -I. -I$(GEM_DIR)/src -I$(PD_DIR)/src \ + -I$(OPENCV_DIR)/cv/include -I$(OPENCV_DIR)/cxcore/include GEM_OPENCV_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 +UNAME := $(shell uname -s) +ifeq ($(UNAME),Linux) + LDFLAGS = -export_dynamic -shared + EXTENSION = pd_linux +endif +ifeq ($(UNAME),Darwin) + LDFLAGS = -bundle -undefined dynamic_lookup + EXTENSION = pd_darwin +endif -all: pix_opencv_edge.pd_linux pix_opencv_laplace.pd_linux pix_opencv_morphology.pd_linux pix_opencv_distrans.pd_linux pix_opencv_motempl.pd_linux pix_opencv_haarcascade.pd_linux pix_opencv_contours_boundingrect.pd_linux pix_opencv_bgsubstract.pd_linux pix_opencv_contours_convexity.pd_linux +all: pix_opencv_edge.$(EXTENSION) pix_opencv_laplace.$(EXTENSION) pix_opencv_morphology.$(EXTENSION) pix_opencv_distrans.$(EXTENSION) pix_opencv_motempl.$(EXTENSION) pix_opencv_haarcascade.$(EXTENSION) pix_opencv_contours_boundingrect.$(EXTENSION) pix_opencv_bgsubstract.$(EXTENSION) pix_opencv_contours_convexity.$(EXTENSION) -pix_opencv_contours_convexity.pd_linux: pix_opencv_contours_convexity.o - rm -f pix_opencv_contours_convexity.pd_linux - gcc -export_dynamic -shared -o pix_opencv_contours_convexity.pd_linux pix_opencv_contours_convexity.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_contours_convexity.$(EXTENSION): pix_opencv_contours_convexity.o + rm -f pix_opencv_contours_convexity.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_contours_convexity.$(EXTENSION) pix_opencv_contours_convexity.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_contours_boundingrect.pd_linux: pix_opencv_contours_boundingrect.o - rm -f pix_opencv_contours_boundingrect.pd_linux - gcc -export_dynamic -shared -o pix_opencv_contours_boundingrect.pd_linux pix_opencv_contours_boundingrect.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_contours_boundingrect.$(EXTENSION): pix_opencv_contours_boundingrect.o + rm -f pix_opencv_contours_boundingrect.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_contours_boundingrect.$(EXTENSION) pix_opencv_contours_boundingrect.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_haarcascade.pd_linux: pix_opencv_haarcascade.o - rm -f pix_opencv_haarcascade.pd_linux - gcc -export_dynamic -shared -o pix_opencv_haarcascade.pd_linux pix_opencv_haarcascade.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_haarcascade.$(EXTENSION): pix_opencv_haarcascade.o + rm -f pix_opencv_haarcascade.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_haarcascade.$(EXTENSION) pix_opencv_haarcascade.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_motempl.pd_linux: pix_opencv_motempl.o - rm -f pix_opencv_motempl.pd_linux - gcc -export_dynamic -shared -o pix_opencv_motempl.pd_linux pix_opencv_motempl.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_motempl.$(EXTENSION): pix_opencv_motempl.o + rm -f pix_opencv_motempl.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_motempl.$(EXTENSION) pix_opencv_motempl.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_distrans.pd_linux: pix_opencv_distrans.o - rm -f pix_opencv_distrans.pd_linux - gcc -export_dynamic -shared -o pix_opencv_distrans.pd_linux pix_opencv_distrans.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_distrans.$(EXTENSION): pix_opencv_distrans.o + rm -f pix_opencv_distrans.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_distrans.$(EXTENSION) pix_opencv_distrans.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_morphology.pd_linux: pix_opencv_morphology.o - rm -f pix_opencv_morphology.pd_linux - gcc -export_dynamic -shared -o pix_opencv_morphology.pd_linux pix_opencv_morphology.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_morphology.$(EXTENSION): pix_opencv_morphology.o + rm -f pix_opencv_morphology.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_morphology.$(EXTENSION) pix_opencv_morphology.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_laplace.pd_linux: pix_opencv_laplace.o - rm -f pix_opencv_laplace.pd_linux - gcc -export_dynamic -shared -o pix_opencv_laplace.pd_linux pix_opencv_laplace.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_laplace.$(EXTENSION): pix_opencv_laplace.o + rm -f pix_opencv_laplace.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_laplace.$(EXTENSION) pix_opencv_laplace.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_edge.pd_linux: pix_opencv_edge.o - rm -f pix_opencv_edge.pd_linux - gcc -export_dynamic -shared -o pix_opencv_edge.pd_linux pix_opencv_edge.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_edge.$(EXTENSION): pix_opencv_edge.o + rm -f pix_opencv_edge.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_edge.$(EXTENSION) pix_opencv_edge.o $(LIBS) `pkg-config --libs opencv` -pix_opencv_bgsubstract.pd_linux: pix_opencv_bgsubstract.o - rm -f pix_opencv_bgsubstract.pd_linux - gcc -export_dynamic -shared -o pix_opencv_bgsubstract.pd_linux pix_opencv_bgsubstract.o $(LIBS) `pkg-config --libs opencv` +pix_opencv_bgsubstract.$(EXTENSION): pix_opencv_bgsubstract.o + rm -f pix_opencv_bgsubstract.$(EXTENSION) + gcc $(LDFLAGS) -o pix_opencv_bgsubstract.$(EXTENSION) pix_opencv_bgsubstract.o $(LIBS) `pkg-config --libs opencv` clean: - rm -f *.o - rm -f pix_opencv*.pd_linux + rm -f pix_opencv*.o + rm -f pix_opencv*.$(EXTENSION) distro: clean all rm *.o -.cpp.o: - g++ $(GEM_OPENCV_CPPFLAGS) $(GEM_OPENCV_INCLUDE) `pkg-config --cflags opencv` -o $*.o -c $*.cpp +.cc.o: + g++ $(GEM_OPENCV_CPPFLAGS) $(GEM_OPENCV_INCLUDE) `pkg-config --cflags opencv` -o $*.o -c $*.cc .c.o: gcc $(GEM_OPENCV_CPPFLAGS) $(GEM_OPENCV_INCLUDE) -o $*.o -c $*.c -- cgit v1.2.1