1srcdir = @srcdir@
2top_srcdir = @top_srcdir@
3VPATH = @srcdir@
4
5include ../Makefile.config
6
7
8CCFLAGS	= $(OPT) @CFLAGS@ $(INTLOPTS) $(DEBUGGING) $(WAISTYPE) $(SOCKSFLAGS) -I.. -I$(srcdir)  -I$(top_srcdir)
9
10OBJS	= STRstring.o GDgopherdir.o GSgopherobj.o \
11	  DAarray.o   VIews.o       BLblock.o \
12	  Sockets.o   util.o        compatible.o \
13	  url.o       Debug.o       Regex.o \
14	  fileio.o    Locale.o      RBTree.o
15
16
17TARGET	= libgopher.a libgopher.so.0.1
18
19all: shared $(TARGET)
20
21#
22# Make shared library directories
23#
24shared:
25	@-if [ -f /lib/ld.so -a "$(SHAREDLIB)" = "sun" ]; \
26	then \
27		mkdir shared-sun; \
28	fi
29	touch shared
30
31
32.c.o: $(OBJS)
33	@CC@ $(CCFLAGS) $(PIC) -c $<
34	@-if [ -d shared-sun ]; then \
35		echo "Building shared version of $@"; \
36		@CC@ $(CCFLAGS) -fPIC -o shared-sun/$@ -c $<; \
37	fi
38
39#
40# Stuff for shared libraries
41#
42
43libgopher.so.0.1: $(OBJS)
44	@-if [ -d shared-sun ]; then \
45		echo "Building shared library $@"; \
46		cd shared-sun; \
47		rm -f $@; \
48		ld -o $@ -assert pure-text $(OBJS);\
49		mv $@ ..; \
50	fi
51
52libgopher.sa.0.1: $(OBJS)
53	;
54
55
56libgopher.a: $(OBJS)
57	rm -f libgopher.a
58	ar rcv libgopher.a $(OBJS)
59	@RANLIB@ libgopher.a || true
60
61clean:
62	-rm -f $(TARGET) $(OBJS) *.out *~ core TAGS \
63	       *.sa.* shared
64	-rm -rf shared-sun
65
66GSgopherobj.o:	$(srcdir)/GSgopherobj.h
67
68
69Locale.o: $(srcdir)/Locale.h $(srcdir)/Locale.c
70	@CC@ $(CCFLAGS) $(PIC) -DLOCALEDIR=\"$(CLIENTLIB)/gophernls\" -c $(srcdir)/Locale.c
71	@-if [ -d shared-sun ]; then \
72		echo "Building shared version of $@"; \
73		@CC@ $(CCFLAGS) -DLOCALEDIR=\"$(CLIENTLIB)/gophernls\" \
74			-fPIC -o shared-sun/$@ -c $(srcdir)/Locale.c; \
75	fi
76
77#
78#install shared libraries if need be..
79#
80install:
81	@-if [ -f *.so.* ]; then \
82	  echo "Installing Sun shared gopher library" ;\
83	  @INSTALL@ libgopher.so.0.1 $(CLIENTLIB); \
84	  @INSTALL@ libgopher.a $(CLIENTLIB); \
85	fi
86
87