From 97c71acb56c0d422f8d44cebba3b6ecd9c94ab5f Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 13 Oct 2015 01:48:06 +0300 Subject: Add support for static compilation Signed-off-by: Laurent Pinchart --- Makefile | 14 +++++++++++--- isp/Makefile | 5 ++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 07d1973..1783f55 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,18 @@ CROSS_COMPILE ?= KDIR ?= +STATIC ?= CC := $(CROSS_COMPILE)gcc CFLAGS := -O2 -W -Wall -I$(KDIR)/usr/include LDFLAGS := -Lisp -LIBS := -lomap3isp -lrt +LIBS := -lomap3isp -lpthread -lrt + +ifneq (x$(STATIC), x) +LIBS += -static +LIB_ISP := isp/libomap3isp.a +else +LIB_ISP := isp/libomap3isp.so +endif OBJ_LIVE := live.o events.o iq.o videoout.o OBJ_SNAP := snapshot.o events.o iq.o @@ -21,10 +29,10 @@ endif all: __isp live snapshot -live: $(OBJ_LIVE) isp/libomap3isp.so +live: $(OBJ_LIVE) $(LIB_ISP) $(CC) $(LDFLAGS) -o $@ $(OBJ_LIVE) $(LIBS) -snapshot: $(OBJ_SNAP) isp/libomap3isp.so +snapshot: $(OBJ_SNAP) $(LIB_ISP) $(CC) $(LDFLAGS) $(SNAP_LDFLAGS) -o $@ $(OBJ_SNAP) $(LIBS) $(SNAP_LIBS) __isp: diff --git a/isp/Makefile b/isp/Makefile index 6521a95..5619ca6 100644 --- a/isp/Makefile +++ b/isp/Makefile @@ -14,7 +14,10 @@ OBJECTS := controls.o \ %.o : %.c $(CC) $(CFLAGS) -c -o $@ $< -all: libomap3isp.so +all: libomap3isp.a libomap3isp.so + +libomap3isp.a: $(OBJECTS) + $(AR) r $@ $^ libomap3isp.so: $(OBJECTS) $(CC) -o $@ -shared $^ -- cgit v1.2.3