aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2018-04-16 16:04:22 -0400
committercnlohr <lohr85@gmail.com>2018-04-16 16:04:22 -0400
commit1d1d01a437237c2ac9acb3836fc926e554eb96cd (patch)
tree142db153fb7c964c4e8c455cef278c2124cec890 /Makefile
parent9dcb88216b6103660bfd913a4b2de4082b78086c (diff)
downloadlibsurvive-1d1d01a437237c2ac9acb3836fc926e554eb96cd.tar.gz
libsurvive-1d1d01a437237c2ac9acb3836fc926e554eb96cd.tar.bz2
Include build rules for static library (But don't use static library)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 9 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index de0f392..1095723 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,11 @@
-all : data_recorder test calibrate calibrate_client simple_pose_test
+LIBRARY:=./lib/libsurvive.so
+STATIC_LIBRARY:=./lib/libsurvive.a
+
+all : $(STATIC_LIBRARY) $(LIBRARY) data_recorder test calibrate calibrate_client simple_pose_test
@echo "Built with defaults. Type 'make help' for more info."
.PHONY : help clean buildfolders
-LIBRARY:=./lib/libsurvive.so
OBJDIR:=build
@@ -14,7 +16,7 @@ ifdef WINDOWS
LIBSURVIVE_CORE:=redist/puff.c redist/crc32.c redist/hid-windows.c winbuild/getdelim.c
CC:=i686-w64-mingw32-gcc
else
- CFLAGS+=-Iinclude/libsurvive -fPIC -g -O3 -Iredist -DUSE_DOUBLE -std=gnu99 -rdynamic -MD
+ CFLAGS+=-Iinclude/libsurvive -fPIC -g -O3 -Iredist -DUSE_DOUBLE -std=gnu99 -rdynamic -MD -flto
LDFLAGS+=-L/usr/local/lib -lpthread -lz -lm -g -llapacke -lcblas -lm -lusb-1.0
LDFLAGS_TOOLS+=-Llib -lsurvive -Wl,-rpath,lib -lX11 $(LDFLAGS)
endif
@@ -141,6 +143,9 @@ $(OBJDIR):
$(LIBRARY): $(LIBSURVIVE_O) $(OBJDIR)
$(CC) -o $@ $(LIBSURVIVE_O) $(CFLAGS) $(LDFLAGS) -shared
+$(STATIC_LIBRARY) : $(LIBSURVIVE_O) $(OBJDIR)
+ ar rcs --plugin=$$(gcc --print-file-name=liblto_plugin.so) lib/libsurvive.a $(LIBSURVIVE_O)
+
$(OBJDIR)/%.o : %.c $(OBJDIR)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -148,7 +153,7 @@ calibrate_tcc : $(LIBSURVIVE_C)
tcc -DRUNTIME_SYMNUM $(CFLAGS) -o $@ $^ $(LDFLAGS) calibrate.c $(DRAWFUNCTIONS) redist/symbol_enumerator.c
clean :
- rm -rf */*/*.o *.o src/*.o $(OBJDIR) *~ src/*~ test simple_pose_test data_recorder calibrate testCocoa lib/libsurvive.so test_minimal_cv test_epnp test_epnp_ocv calibrate_client redist/*.o redist/*~ tools/data_server/data_server tools/lighthousefind/lighthousefind tools/lighthousefind_tori/lighthousefind-tori tools/plot_lighthouse/plot_lighthouse tools/process_rawcap/process_to_points redist/jsmntest redist/lintest
+ rm -rf $(OBJDIR) lib/libsurvive.a *~ src/*~ test simple_pose_test data_recorder calibrate testCocoa lib/libsurvive.so test_minimal_cv test_epnp test_epnp_ocv calibrate_client redist/*.o redist/*~ tools/data_server/data_server tools/lighthousefind/lighthousefind tools/lighthousefind_tori/lighthousefind-tori tools/plot_lighthouse/plot_lighthouse tools/process_rawcap/process_to_points redist/jsmntest redist/lintest
.test_redist:
cd redist && make .run_tests;