# $Id: Makefile 202 2008-05-21 16:32:32Z luigi $
#
# Makefile for the creation of firefox plugins.
#
# This is meant to work with gmake, but hopefully with bsd make as well.

BINARIES= host sdl
# In general, you should include the headers in the mozilla
# directories, i.e. include/firefox and include/nspr.
# However, just using the local copy of the headers is
# probably enough
#CFLAGS += -I /usr/local/include/firefox -I/usr/local/include/nspr
CFLAGS += -Iinclude
# and of course, on FreeBSD we need /usr/local/include
CFLAGS += -I/usr/local/include
CFLAGS += -Wall -Werror -O1

LIB += -L/usr/local/lib -lXt -lSDL -pthread

all: app-wrapper.so

myplugin.o: myplugin.h

app-wrapper.o: myplugin.h

app-wrapper.so:	app-wrapper.o myplugin.o
	$(CC) -shared -o $@ $(LIB) app-wrapper.o myplugin.o

tgz:
	tar cvzf app-wrapper-`date +%Y%m%d-%H%M%S`.tgz \
		--exclude .svn \
		app-wrapper.c app-wrapper.conf myplugin.[ch] \
		README include Makefile

# host.c is a simple program that opens an X11 window and returns its id
# sdl.c is a program that opens an SDL application in an externally-supplied
# X11 window
host:	host.c
	$(CC) $(CFLAGS) -o $@ host.c $(LIB)
sdl:	sdl.c
	$(CC) $(CFLAGS) -o $@ sdl.c $(LIB)
clean:
	@echo "cleaning *.so *.o $(BINARIES)"
	-@rm -f *.so *.o $(BINARIES)
