Commit 167e5b78 authored by Bernd Machenschalk's avatar Bernd Machenschalk
Browse files

Makefile improvements

- allow to build shared and static versions separately

- fix OSX shared build
parent 7439e79e
...@@ -3,25 +3,33 @@ AMDAPPSDKROOT ?= /opt/AMDAPP ...@@ -3,25 +3,33 @@ AMDAPPSDKROOT ?= /opt/AMDAPP
CXX ?= g++ CXX ?= g++
AR ?= ar AR ?= ar
TARGET = libclfft.a TARGET = libeclfft.a
TARGET2 = libclfft.so TARGET2 = libeclfft.so
CXXFLAGS += -O3 -Wall -g -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -I$(AMDAPPSDKROOT)/include -I../include -fPIC CXXFLAGS += -O3 -Wall -g -I$(NVIDIA_SDK_INSTALL_PATH)/OpenCL/common/inc -I$(AMDAPPSDKROOT)/include -I../include -fPIC
OS = $(shell uname -s) OS = $(shell uname -s)
ifeq ($(OS), Darwin) ifeq ($(OS), Darwin)
CXXFLAGS += -I/System/Library/Frameworks CXXFLAGS += -I/System/Library/Frameworks
LDFLAGS += -framework OpenCL
endif endif
OBJECTS = fft_setup.o fft_execute.o fft_kernelstring.o OBJECTS = fft_setup.o fft_execute.o fft_kernelstring.o
PREFIX ?= "." PREFIX ?= "."
default: static shared
static: $(TARGET)
shared: $(TARGET2)
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(AR) rcs $(TARGET) $(OBJECTS) $(AR) rcs $(TARGET) $(OBJECTS)
$(CXX) -shared -o $(TARGET2) $(OBJECTS)
mkdir -p ../lib mkdir -p ../lib
cp $(TARGET) ../lib/ cp $(TARGET) ../lib/libclfft.a
cp $(TARGET2) ../lib/
$(TARGET2): $(OBJECTS)
$(CXX) $(LDFLAGS) -shared -o $(TARGET2) $(OBJECTS)
fft_setup.o: fft_setup.cpp fft_internal.h fft_base_kernels.h fft_setup.o: fft_setup.cpp fft_internal.h fft_base_kernels.h
$(CXX) $(CXXFLAGS) -c fft_setup.cpp $(CXX) $(CXXFLAGS) -c fft_setup.cpp
...@@ -35,9 +43,7 @@ fft_kernelstring.o: fft_kernelstring.cpp ../include/clFFT.h fft_internal.h ...@@ -35,9 +43,7 @@ fft_kernelstring.o: fft_kernelstring.cpp ../include/clFFT.h fft_internal.h
install: $(TARGET) ../include/clFFT.h install: $(TARGET) ../include/clFFT.h
mkdir -p $(PREFIX)/lib $(PREFIX)/include mkdir -p $(PREFIX)/lib $(PREFIX)/include
cp ../include/clFFT.h $(PREFIX)/include/eclfft.h cp ../include/clFFT.h $(PREFIX)/include/eclfft.h
cp $(TARGET) $(PREFIX)/lib/libeclfft.a cp libeclfft.* $(PREFIX)/lib/
cp $(TARGET2) $(PREFIX)/lib/libeclfft.so
clean: clean:
rm -f *.o rm -f *.o *.a *.so
rm -f *.a
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment