From 167e5b788649b2532dd1565354a3a41a12d9a33a Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Thu, 21 Feb 2019 07:36:25 +0100 Subject: [PATCH 1/8] Makefile improvements - allow to build shared and static versions separately - fix OSX shared build --- src/Makefile | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Makefile b/src/Makefile index 6651b74..ec07dba 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,25 +3,33 @@ AMDAPPSDKROOT ?= /opt/AMDAPP CXX ?= g++ AR ?= ar -TARGET = libclfft.a -TARGET2 = libclfft.so +TARGET = libeclfft.a +TARGET2 = libeclfft.so CXXFLAGS += -O3 -Wall -g -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -I$(AMDAPPSDKROOT)/include -I../include -fPIC OS = $(shell uname -s) ifeq ($(OS), Darwin) CXXFLAGS += -I/System/Library/Frameworks + LDFLAGS += -framework OpenCL endif OBJECTS = fft_setup.o fft_execute.o fft_kernelstring.o PREFIX ?= "." +default: static shared + +static: $(TARGET) + +shared: $(TARGET2) + $(TARGET): $(OBJECTS) $(AR) rcs $(TARGET) $(OBJECTS) - $(CXX) -shared -o $(TARGET2) $(OBJECTS) mkdir -p ../lib - cp $(TARGET) ../lib/ - cp $(TARGET2) ../lib/ + cp $(TARGET) ../lib/libclfft.a + +$(TARGET2): $(OBJECTS) + $(CXX) $(LDFLAGS) -shared -o $(TARGET2) $(OBJECTS) fft_setup.o: fft_setup.cpp fft_internal.h fft_base_kernels.h $(CXX) $(CXXFLAGS) -c fft_setup.cpp @@ -35,9 +43,7 @@ fft_kernelstring.o: fft_kernelstring.cpp ../include/clFFT.h fft_internal.h install: $(TARGET) ../include/clFFT.h mkdir -p $(PREFIX)/lib $(PREFIX)/include cp ../include/clFFT.h $(PREFIX)/include/eclfft.h - cp $(TARGET) $(PREFIX)/lib/libeclfft.a - cp $(TARGET2) $(PREFIX)/lib/libeclfft.so + cp libeclfft.* $(PREFIX)/lib/ clean: - rm -f *.o - rm -f *.a + rm -f *.o *.a *.so -- GitLab From aca23d274fd0f7bda39161a4dff04e2f55a0437a Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Thu, 13 Jun 2019 16:02:44 +0200 Subject: [PATCH 2/8] fix MinGW build --- src/Makefile.mingw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 1f7e6e4..9ba45e9 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -3,7 +3,7 @@ AMDAPPSDKROOT ?= /opt/AMDAPP CXX ?= i586-mingw32msvc-g++ AR ?= i586-mingw32msvc-ar -TARGET = libclfft.a +TARGET = libeclfft.a CXXFLAGS += -O3 -Wall -g -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -I$(AMDAPPSDKROOT)/include -I../include -- GitLab From e01a2fd14b46c7656fe9a4da1626d7cd085d580c Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Fri, 14 Jun 2019 07:34:20 +0200 Subject: [PATCH 3/8] Makefile: improve selection of possible include paths --- src/Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index ec07dba..bfa7b79 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,22 @@ AR ?= ar TARGET = libeclfft.a TARGET2 = libeclfft.so -CXXFLAGS += -O3 -Wall -g -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -I$(AMDAPPSDKROOT)/include -I../include -fPIC +ifndef OPENCL_INCLUDE +ifdef AMDAPPSDKROOT +OPENCL_INCLUDE = $(AMDAPPSDKROOT)/include +endif +ifdef NVIDIA_SDK_INSTALL_PATH +OPENCL_INCLUDE = $(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc +endif +ifdef CUDA_INSTALL_PATH +OPENCL_INCLUDE = $(CUDA_INSTALL_PATH)/include +endif +ifdef OPENCL_INSTALL_PATH +OPENCL_INCLUDE = $(OPENCL_INSTALL_PATH)/include +endif +endif + +CXXFLAGS += -O3 -Wall -g -I$(OPENCL_INCLUDE) -I../include -fPIC OS = $(shell uname -s) ifeq ($(OS), Darwin) CXXFLAGS += -I/System/Library/Frameworks -- GitLab From 9ba1bd5c9f1b8d9bf17b5d9592e246d4129e0d2e Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Fri, 14 Jun 2019 15:25:28 +0200 Subject: [PATCH 4/8] fix selection of possible include paths --- src/Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index bfa7b79..b3b31c8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,12 +7,6 @@ TARGET = libeclfft.a TARGET2 = libeclfft.so ifndef OPENCL_INCLUDE -ifdef AMDAPPSDKROOT -OPENCL_INCLUDE = $(AMDAPPSDKROOT)/include -endif -ifdef NVIDIA_SDK_INSTALL_PATH -OPENCL_INCLUDE = $(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -endif ifdef CUDA_INSTALL_PATH OPENCL_INCLUDE = $(CUDA_INSTALL_PATH)/include endif @@ -20,6 +14,9 @@ ifdef OPENCL_INSTALL_PATH OPENCL_INCLUDE = $(OPENCL_INSTALL_PATH)/include endif endif +ifndef OPENCL_INCLUDE +OPENCL_INCLUDE = $(AMDAPPSDKROOT)/include -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc +endif CXXFLAGS += -O3 -Wall -g -I$(OPENCL_INCLUDE) -I../include -fPIC OS = $(shell uname -s) -- GitLab From 6123b933f9e0651588e01614884744773afde79c Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Fri, 14 Jun 2019 15:26:04 +0200 Subject: [PATCH 5/8] allow static and shared builds from top level --- Makefile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ae776dd..ba7d6c5 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,16 @@ default: linux -linux: - $(MAKE) -C src - $(MAKE) -C example +linux: static shared example + +macos: linux + +static: + $(MAKE) -C src static + +shared: + $(MAKE) -C src shared -macos: - $(MAKE) -C src +example: $(MAKE) -C example win32: -- GitLab From cec37b69e01e59089a684dbd957ae70d1b7943ce Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Fri, 14 Jun 2019 15:38:08 +0200 Subject: [PATCH 6/8] don't force building the static version when installing --- src/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index b3b31c8..fca56f0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -52,7 +52,7 @@ fft_execute.o: fft_execute.cpp ../include/clFFT.h fft_internal.h fft_kernelstring.o: fft_kernelstring.cpp ../include/clFFT.h fft_internal.h $(CXX) $(CXXFLAGS) -c fft_kernelstring.cpp -install: $(TARGET) ../include/clFFT.h +install: ../include/clFFT.h libeclfft.* mkdir -p $(PREFIX)/lib $(PREFIX)/include cp ../include/clFFT.h $(PREFIX)/include/eclfft.h cp libeclfft.* $(PREFIX)/lib/ -- GitLab From 06adfda0cc6d924e48f4e1a82356d21090b38a5c Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Mon, 17 Jun 2019 10:40:04 +0200 Subject: [PATCH 7/8] Makefile: renamed target 'sample' to avoid conflict with directory name --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ba7d6c5..beff620 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ default: linux -linux: static shared example +linux: static shared sample macos: linux @@ -10,7 +10,7 @@ static: shared: $(MAKE) -C src shared -example: +sample: $(MAKE) -C example win32: -- GitLab From 4967ca6401379768a745c8f3a927e1ecc9bed913 Mon Sep 17 00:00:00 2001 From: Bernd Machenschalk Date: Mon, 12 Aug 2019 09:41:48 +0200 Subject: [PATCH 8/8] example/Makefile: adapt the include path selection from src/Makefile here --- example/Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/example/Makefile b/example/Makefile index 9fc9cf5..1d7e4b4 100644 --- a/example/Makefile +++ b/example/Makefile @@ -5,7 +5,19 @@ CXX ?= g++ TARGET = clfft_example -CXXFLAGS += -O3 -Wall -g -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -I$(AMDAPPSDKROOT)/include -I../include +ifndef OPENCL_INCLUDE +ifdef CUDA_INSTALL_PATH +OPENCL_INCLUDE = $(CUDA_INSTALL_PATH)/include +endif +ifdef OPENCL_INSTALL_PATH +OPENCL_INCLUDE = $(OPENCL_INSTALL_PATH)/include +endif +endif +ifndef OPENCL_INCLUDE +OPENCL_INCLUDE = $(AMDAPPSDKROOT)/include -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc +endif + +CXXFLAGS += -O3 -Wall -g -I$(OPENCL_INCLUDE) -I../include -fPIC LDFLAGS += $(PWD)/../lib/libclfft.a OS = $(shell uname -s) -- GitLab