# Install variables
prefix=@prefix@

#Pilot flags (include dir), and Libraries
PILOT_FLAGS=@PILOT_FLAGS@
PILOT_LIBS=@PILOT_LIBS@

#set CC to your compiler
CC = @CC@

# CC options
CCDEFINES = @DEFS@
CFLAGS = @cflags@

# CC options
OPTIONS = @ccoptions@ $(CFLAGS)

# GTK+ flags
GTKFLAGS = @GTK_CFLAGS@
# GTK+ libs
GTKLIBS = @GTK_LIBS@

# Targets
all: libsynctime.so warn

warn:
	echo; echo "WARNING - SyncTime is currently broken for PalmOS 3.3"; echo

libsynctime.so: synctime.o libplugin.a
	ld -shared -ldl -o libsynctime.so synctime.o -L. -lplugin

synctime.o: synctime.c libplugin.h
	$(CC) $(OPTIONS) $(GTKFLAGS) $(PILOT_FLAGS) -c synctime.c

clean: 
	rm -f *.o *~ config.cache 

distclean: clean
	rm -f config.status config.log *.so Makefile

#
# This is a global install.  You can also install per user in
# ~/.jpilot/plugins
#
install:
	./install-sh -d -m 755 $(prefix)/lib/jpilot; \
	./install-sh -d -m 755 $(prefix)/lib/jpilot/plugins; \
	./install-sh -d -m 755 $(prefix)/lib/jpilot/plugins
	./install-sh -c -m 755 -g bin -o bin libsynctime.so \
	$(prefix)/lib/jpilot/plugins

uninstall:
	rm $(prefix)/lib/jpilot/plugins/libsynctime.so
