CFLAGS:=-O2 -fPIC -g
CFLAGS+=-D_LINUX -I../include

# uncomment this to enable debugging 
CFLAGS+=-Wall #-DCJPPA_DEBUG

SRCS = \
	cjccid.c \
	cjdata.c \
	cjppUpdate.c \
	cjppPlatformLinux.c \
	cjppDebugOutLinux.c \
	SyncInterpreter.c \
	ausb/ausb.c
	
OBJS=$(SRCS:.c=.o)

all: libctapi-ppa.a # libctapi-ppa.so

%.o: %.c
	$(CC) $(CFLAGS) -o $@ -c $<

libctapi-ppa.so: $(OBJS)
	ld -x --shared -o $@ $^

libctapi-ppa.a: $(OBJS)
	ar r $@ $^
	if test -s /bin/ranlib; then /bin/ranlib $@; else if test -s /usr/bin/ranlib; then /usr/bin/ranlib $@; else exit 0; fi; fi

ctapi_test: ctapi_test.o libctapi-cyberjack.a
	$(CC) -lusb -o $@ $^ 

clean:
	rm -f $(OBJS) libctapi-ppa.a libctapi-ppa.so
