#
# Plugin sample makefile from the Eddie Plugin Developer Kit
#
# (c) 1998 P.Cisler
#
# You may use any parts of this makefile in your own plugins
#
# To build the plugin samples, in Eddie Worksheet:
#	cd to the developer kit directory
# 	type make
#	drag the resulting plugins into the Eddie plugin folder
#	restart Eddie
#
#
SHELL := /bin/sh
#


ifeq ($(PLATFORM), intel)
pluginType:= "application/x-vnd.Be-peexecutable"
else
pluginType:= "application/x-be-executable"
endif

CFLAGS += -c
LDFLAGS += -G

ifeq ($(PLATFORM), intel)
	LIBRARIES = \
		$(BELIBRARIES)/glue-noinit.a \
		$(BELIBRARIES)/init_term_dyn.o \
		$(BELIBRARIES)/start_dyn.o \
		$(BELIBRARIES)/libroot.so.LIB \
		$(BELIBRARIES)/libbe.so.LIB \
		$(BELIBRARIES)/libnet.so.LIB \
		$(BELIBRARIES)/libnetdev.so.LIB \
		$(BELIBRARIES)/libmail.so.LIB \
		$(BELIBRARIES)/libtracker.so.LIB \
		$(BELIBRARIES)/libdevice.so.LIB \
		$(BELIBRARIES)/libgame.so.LIB \
		$(BELIBRARIES)/libmedia.so.LIB \
		$(BELIBRARIES)/libmidi.so.LIB
else
	LIBRARIES = \
		libbe.so \
		libroot.so \
		libdll.a \
		libtracker.so
endif

all: \
	keyPressSample \
	Commenter \
	DoNothingSample \
#

keyPressSampleObjs := \
	KeyPressHandling.o \
#

commenterObjs := \
	Commenter.o \
#

doNothingSampleObjs := \
	CutNPasteSource.o \
#

keyPressSample: $(keyPressSampleObjs)
	$(LD) -o $@ $< $(LDFLAGS) $(LIBRARIES) -map $@.xMAP
	settype -t $(pluginType) $@ 
	chmod +x $@
	mimeset -f $@

Commenter: $(commenterObjs)
	$(LD) -o $@ $< $(LDFLAGS) $(LIBRARIES) -map $@.xMAP
	settype -t $(pluginType) $@ 
	chmod +x $@
	mimeset -f $@

DoNothingSample: $(doNothingSampleObjs)
	$(LD) -o $@ $< $(LDFLAGS) $(LIBRARIES) -map $@.xMAP
	settype -t $(pluginType) $@ 
	chmod +x $@
	mimeset -f $@

.PHONY: clean
clean:
	rm -f *.o *.xMAP *.xSYM *.LIB
	rm keyPressSample Commenter DoNothingSample

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