1# Netscape Plugin for Squeak on Unix platforms
2# Author: Bert Freudenberg
3# Last edited: 2007-10-12 20:03:33 by piumarta on emilia
4
5############ Customize flags here #######################
6
7INC	= -I./include -I/usr/X11R6/include
8CC	= gcc
9CFLAGS	= $(INC) -O2 -fPIC -Wall
10LD	= gcc
11LDFLAGS = -L/usr/X11R6/lib -lXt
12
13# usually overridden from top level makefile
14VM_VERSION=  3.9-12
15bindir=	     /usr/local/bin
16imgdir=	     /usr/local/share/squeak
17plgdir=	     /usr/local/lib/squeak/$(VM_VERSION)
18
19# configuration
20scriptdir=	$(imgdir)
21npsqueakrun=	npsqueakrun
22
23
24############ compile and link ###########################
25all: npsqueak.so npsqueakrun
26
27npsqueak.so : npsqueak.la
28	-@rm -f npsqueak.so
29	ln .libs/npsqueak npsqueak.so
30
31npsqueak.la : npsqueak.lo npunix.lo
32	../libtool --mode=link $(LD) $(LDFLAGS) npsqueak.lo npunix.lo -avoid-version -module -rpath $(plgdir) -o npsqueak.la
33
34npsqueak.lo: npsqueak.c ../config.h
35	../libtool --mode=compile $(CC) -c $(CFLAGS) \
36		-DSYSTEM_BIN_DIR=\"$(scriptdir)\" \
37		-DSYSTEM_IMG_DIR=\"$(imgdir)\" \
38		-DNPSQUEAKRUN=\"$(npsqueakrun)\" npsqueak.c
39
40npunix.lo: npunix.c
41	../libtool --mode=compile $(CC) -c $(CFLAGS) npunix.c
42
43npsqueakrun: npsqueakrun.in
44	sed "s|@imgdir@|$(imgdir)|; \
45	     s|@VM_VERSION@|$(VM_VERSION)|" \
46		npsqueakrun.in > npsqueakrun
47	chmod +x npsqueakrun
48
49npsqueakregister: npsqueakregister.in
50	sed "s|@NPSQUEAK_SO@|$(plgdir)/npsqueak.so|" \
51		npsqueakregister.in > npsqueakregister
52	chmod +x npsqueakregister
53
54
55clean:
56	-rm -rf *.lo *.la *.o *.so *~ .*~ */*~ */.*~ .libs
57
58
59############ install ####################################
60
61$(ROOT)$(scriptdir):
62	install -d $(ROOT)$(scriptdir)
63
64$(ROOT)$(plgdir):
65	install -d $(ROOT)$(plgdir)
66
67$(ROOT)$(plgdir)/npsqueak.so: npsqueak.so $(ROOT)$(plgdir)
68	cp npsqueak.so $(ROOT)$(plgdir)/npsqueak.so
69	strip $(ROOT)$(plgdir)/npsqueak.so
70
71$(ROOT)$(scriptdir)/npsqueakrun: npsqueakrun $(ROOT)$(scriptdir)
72	cp npsqueakrun $(ROOT)$(scriptdir)/npsqueakrun
73
74
75$(ROOT)$(imgdir)/npsqueakregister: npsqueakregister $(ROOT)$(scriptdir)
76	cp npsqueakregister $(ROOT)$(imgdir)/npsqueakregister
77
78### Go! ###
79
80NPSQUEAK_TARGETS=                   \
81	$(ROOT)$(plgdir)/npsqueak.so    \
82	$(ROOT)$(scriptdir)/npsqueakrun    \
83	$(ROOT)$(scriptdir)/npsqueakregister
84
85install: $(NPSQUEAK_TARGETS)
86
87uninstall:
88	rmdir --ignore-fail-on-non-empty $(ROOT)$(imgdir)
89	rm -rf $(NPSQUEAK_TARGETS)
90
91
92
93