-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If compilation fails with the
-fopenmp
flag, retry without the `-fo…
…penmp` flag. Fixes #39 (#40) * If compilation fails with -fopenmp flag, try again without that flag * Add "deps/build.log" to .gitignore
- Loading branch information
1 parent
2d8be89
commit ee10177
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
*.so.2 | ||
*.o | ||
test*.jl | ||
|
||
deps/build.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,47 @@ | ||
CXX ?= g++ | ||
CFLAGS = -Wall -Wconversion -O3 -fPIC -fopenmp | ||
CFLAGS_normal = -Wall -Wconversion -O3 -fPIC -DENABLEOPENMP -fopenmp | ||
CFLAGS_fallback = -Wall -Wconversion -O3 -DDISABLEOPENMP -fPIC | ||
SHVER = 2 | ||
OS = $(shell uname) | ||
|
||
all: svm-train svm-predict svm-scale | ||
|
||
lib: svm.o | ||
lib: | ||
$(MAKE) lib_normal || $(MAKE) lib_fallback | ||
|
||
lib_normal: svm.o | ||
if [ "$(OS)" = "Darwin" ]; then \ | ||
SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)"; \ | ||
else \ | ||
SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \ | ||
fi; \ | ||
$(CXX) $${SHARED_LIB_FLAG} -DENABLEOPENMP -fopenmp svm.o -o libsvm.so.$(SHVER) | ||
|
||
lib_fallback: svm.o | ||
if [ "$(OS)" = "Darwin" ]; then \ | ||
SHARED_LIB_FLAG="-dynamiclib -Wl,-install_name,libsvm.so.$(SHVER)"; \ | ||
else \ | ||
SHARED_LIB_FLAG="-shared -Wl,-soname,libsvm.so.$(SHVER)"; \ | ||
fi; \ | ||
$(CXX) $${SHARED_LIB_FLAG} -fopenmp svm.o -o libsvm.so.$(SHVER) | ||
$(CXX) $${SHARED_LIB_FLAG} -DDISABLEOPENMP svm.o -o libsvm.so.$(SHVER) | ||
|
||
svm-predict: svm-predict.c svm.o | ||
$(CXX) $(CFLAGS) svm-predict.c svm.o -o svm-predict -lm | ||
|
||
svm-train: svm-train.c svm.o | ||
$(CXX) $(CFLAGS) svm-train.c svm.o -o svm-train -lm | ||
|
||
svm-scale: svm-scale.c | ||
$(CXX) $(CFLAGS) svm-scale.c -o svm-scale | ||
svm.o: svm.cpp svm.h | ||
$(CXX) $(CFLAGS) -c svm.cpp | ||
|
||
svm.o: | ||
$(MAKE) svm.o_normal || $(MAKE) svm.o_fallback | ||
|
||
svm.o_normal: svm.cpp svm.h | ||
$(CXX) $(CFLAGS_normal) -c svm.cpp | ||
|
||
svm.o_fallback: svm.cpp svm.h | ||
$(CXX) $(CFLAGS_fallblack) -c svm.cpp | ||
|
||
clean: | ||
rm -f *~ svm.o svm-train svm-predict svm-scale libsvm.so.$(SHVER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters