The makefile for generating static/dynamic link libraries is as follows:
#CC:=arm-linux-gcc
CFLAGS := -I..
LDFLAGS := -lpthread -lrt
SRCS := $(wildcard *.c)
ifdef ARCH
libclient := libclient-$(ARCH).a
else
libclient := libclient.a
endif
all: $(libclient) libclient.so
$(libclient): client.o net.o
$(AR) -rcv $@ $^
libclient.so: client.o net.o
$(CC) -shared -o $@ $^
.depend: Makefile $(SRCS)
@$(CC) $(CFLAGS) -MM $(SRCS) >$@
sinclude .depend
clean:
rm -rf *.o .depend $(test_client) apitest $(libclient) libclient.so
The makefile used to link the dynamic link library is as follows:
ARCH=arm-linux
ifdef ARCH
CC:=$(ARCH)-gcc
AR:=$(ARCH)-ar
export ARCH
export CC
export AR
endif
CFLAGS:=-I..
LDFLAGS:=-L. -lrt
SRCS := $(wildcard *.c)
ifdef ARCH
camera_track := camera_track-$(ARCH)
LIB:=-lclient-$(ARCH)
else
camera_track := camera_track
LIB:=-lclient
endif
all: $(camera_track)
$(camera_track): camera_track.o camera_ctrl.o
$(CC) $(LDFLAGS) -o $@ $^ $(LIB)
.depend: Makefile $(SRCS)
@$(CC) $(CFLAGS) -MM $(SRCS) >$@
sinclude .depend
clean:
rm -rf *.o .depend $(camera_track)
You can use the following command to compile the SDK directly using the command line:
Arm-Linux-gcc-L.-LRT-O camera_track camera_track.c camera_ctrl.c-lclient