1#-----------------------------------------------------------------------------
2#
3# SocketIO makefile for the platform @OS@, on the host @host@.
4#
5#-----------------------------------------------------------------------------
6VER=6.0.2
7CC=@CC@
8CFLAGS=@CFLAGS@
9#CFLAGS=-O2 -g -W -Wall -Wimplicit -Wstrict-prototypes -Wmissing-prototypes
10VPATH=@srcdir@
11CPPFLAGS=@CPPFLAGS@
12LDFLAGS=@LDFLAGS@
13LIBS=@LIBS@
14DEFS=@DEFS@@NDEFS@
15PREFIX=@prefix@
16LIB=libsio.a
17LIBSO=libsio.so.5
18LIBSOS=libsio.so
19STRIP=strip
20
21OBJS=\
22PRead.o		  PWrite.o	    SAcceptA.o	      SAcceptS.o \
23SBind.o		  SClose.o	    SConnect.o	      SConnectByName.o \
24SNew.o		  SRead.o	    SReadline.o       SRecv.o \
25SRecvfrom.o	  SRecvmsg.o	    SSelect.o	      SSend.o \
26SSendto.o	  SSendtoByName.o   SWrite.o	      SocketUtil.o \
27StrAddr.o	  UAcceptA.o	    UAcceptS.o	      UBind.o \
28UConnect.o	  UConnectByName.o  UNew.o	      URecvfrom.o \
29USendto.o	  USendtoByName.o   SError.o          main.o \
30SWait.o
31
32SOBJS=\
33PRead.so	   PWrite.so	      SAcceptA.so	 SAcceptS.so \
34SBind.so	   SClose.so	      SConnect.so	 SConnectByName.so \
35SNew.so		   SRead.so	      SReadline.so	 SRecv.so \
36SRecvfrom.so	   SRecvmsg.so	      SSelect.so	 SSend.so \
37SSendto.so	   SSendtoByName.so   SWrite.so		 SocketUtil.so \
38StrAddr.so	   UAcceptA.so	      UAcceptS.so	 UBind.so \
39UConnect.so	   UConnectByName.so  UNew.so		 URecvfrom.so \
40USendto.so	   USendtoByName.so   SError.so          main.so \
41SWait.so
42
43all: $(LIB)
44	-@/bin/ls -l $(LIB)
45	-@echo 'Done.'
46
47$(LIB): $(OBJS)
48	/bin/rm -f $(LIB)
49	ar rv $(LIB) $(OBJS)
50	-@RANLIB@ $(LIB)
51	chmod a+r $(LIB) sio.h usio.h
52
53install: $(LIB)
54	cp $(LIB) $(PREFIX)/lib/$(LIB)
55	cp sio.h usio.h $(PREFIX)/include
56	chmod a+r $(PREFIX)/lib/$(LIB) $(PREFIX)/include/sio.h $(PREFIX)/include/usio.h
57	-@/bin/ls -l $(PREFIX)/lib/$(LIB) $(PREFIX)/include/sio.h $(PREFIX)/include/usio.h
58
59shared: $(LIBSO)
60
61so: $(LIBSO)
62
63$(LIBSO): $(SOBJS)
64	/bin/rm -f $(LIBSO)
65	gcc -shared -Wl,-soname,$(LIBSO) -o $(LIBSO) $(SOBJS)
66	chmod a+r $(LIB) sio.h usio.h
67	-@/bin/ls -l $(LIBSO)
68
69soinstall: $(LIBSO)
70	cp $(LIBSO) $(PREFIX)/lib/$(LIBSO)
71	/bin/rm -f $(PREFIX)/lib/$(LIBSOS)
72	( cd $(PREFIX)/lib ; /bin/ln -s $(LIBSO) $(LIBSOS) )
73	cp sio.h usio.h $(PREFIX)/include
74	chmod a+r $(PREFIX)/lib/$(LIBSO) $(PREFIX)/include/sio.h $(PREFIX)/include/usio.h
75	-@/bin/ls -l $(PREFIX)/lib/$(LIBSO) $(PREFIX)/include/sio.h $(PREFIX)/include/usio.h
76
77ucase_c: ucase_c/ucase_c.c $(LIB)
78	( cd ucase_c ; $(MAKE) "CFLAGS=$(CFLAGS)" "STRIP=$(STRIP)" "LIBS=$(LIBS)" )
79
80ucase_s: ucase_s/ucase_s.c $(LIB)
81	( cd ucase_s ; $(MAKE) "CFLAGS=$(CFLAGS)" "STRIP=$(STRIP)" "LIBS=$(LIBS)" )
82
83srltest: srltest/srltest.c $(LIB)
84	( cd srltest ; $(MAKE) "CFLAGS=$(CFLAGS)" "STRIP=$(STRIP)" "LIBS=$(LIBS)" )
85
86time_c: time_c/time_c.c $(LIB)
87	( cd time_c ; $(MAKE) "CFLAGS=$(CFLAGS)" "STRIP=$(STRIP)" "LIBS=$(LIBS)" )
88
89time_s: time_s/time_s.c $(LIB)
90	( cd time_s ; $(MAKE) "CFLAGS=$(CFLAGS)" "STRIP=$(STRIP)" "LIBS=$(LIBS)" )
91
92samples: ucase_c ucase_s time_c time_s srltest
93
94SHELL=/bin/sh
95.SUFFIXES: .c .o .so
96
97.c.o:
98	$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $< -c
99
100.c.so:
101	$(CC) -fpic $(CFLAGS) $(CPPFLAGS) $(DEFS) $*.c -c -o $*.so
102
103### Cleaning supplies ########################################################
104
105clean:
106	-/bin/rm -f $(OBJS) $(SOBJS) $(LIB) $(LIBSO) ucase_c/ucase_c ucase_s/ucase_s time_c/time_c time_s/time_s
107
108distclean:	clean
109	-/bin/rm -f config.h Makefile config.status config.cache config.log
110
111### Archiving #################################################################
112
113CFILES=\
114PRead.c		  PWrite.c	    SAcceptA.c	      SAcceptS.c \
115SBind.c		  SClose.c	    SConnect.c	      SConnectByName.c \
116SNew.c		  SRead.c	    SReadline.c       SRecv.c \
117SRecvfrom.c	  SRecvmsg.c	    SSelect.c	      SSend.c \
118SSendto.c	  SSendtoByName.c   SWrite.c	      SocketUtil.c \
119StrAddr.c	  UAcceptA.c	    UAcceptS.c	      UBind.c \
120UConnect.c	  UConnectByName.c  UNew.c	      URecvfrom.c \
121USendto.c	  USendtoByName.c   SWait.c           main.c
122
123HFILES=sio.h usio.h
124
125DOCFILES=sio.html
126CFGFILES=config.h.in configure.in configure Makefile.in
127CFGJUNK=config.h Makefile config.*
128MOREJUNK=
129
130# This is everything that is copied when you make a shar or tar.
131PACKAGE=$(DOCFILES) $(HFILES) $(CFGFILES) $(MOREJUNK) $(CFILES)
132
133TMPDIR=/tmp
134TARDIR=sio-$(VER)
135TARFILE=$(TARDIR).tar
136TGZFILE=$(TARDIR).tar.gz
137
138tarcp:
139	-@mkdir -p $(TMPDIR)/TAR/$(TARDIR)
140	-@chmod ga+r $(PACKAGE)
141	-@chmod 755 $(TMPDIR)/TAR/$(TARDIR)
142	cp -pr $(PACKAGE) $(TMPDIR)/TAR/$(TARDIR)
143
144tar: $(PACKAGE)
145	-@mkdir $(TMPDIR)/TAR
146	-@mkdir $(TMPDIR)/TAR/$(TARDIR)
147	-@chmod ga+r $(PACKAGE)
148	find . -depth -type f -print | cut -c3- | grep -v '.o$$' | grep -v '.so$$' | grep -v 'core$$' | grep -v 'Makefile$$' | grep -v 'config.log$$' | grep -v 'config.h$$' | grep -v 'config.cache$$' | grep -v 'config.status$$' | grep -v '.a$$' | grep -v '.lib$$' | grep -v '.ncb$$' | grep -v '.opt$$' | grep -v '.zip$$' | grep -v '.gz$$' | grep -v '.swp$$' | grep -v '.tar$$' | cpio -pdm $(TMPDIR)/TAR/$(TARDIR)
149	( cd $(TMPDIR)/TAR ; tar cf $(TARFILE) $(TARDIR) )
150	cp $(TMPDIR)/TAR/$(TARFILE) .
151	-@chmod 644 $(TARFILE)
152	-@rm -rf $(TMPDIR)/TAR
153	-@ls -l $(TARFILE)
154
155gz: tar
156	gzip -c $(TARFILE) > $(TGZFILE)
157	-@rm $(TARFILE)
158	-@chmod 644 $(TGZFILE)
159	-@ls -l $(TGZFILE)
160
161### Dependencies #############################################################
162
163PRead.o: PRead.c sio.h
164PWrite.o: PWrite.c sio.h
165SAcceptA.o: SAcceptA.c sio.h
166SAcceptS.o: SAcceptS.c sio.h
167SBind.o: SBind.c sio.h
168SClose.o: SClose.c sio.h
169SConnect.o: SConnect.c sio.h
170SConnectByName.o: SConnectByName.c sio.h
171SNew.o: SNew.c sio.h
172SRead.o: SRead.c sio.h
173SReadline.o: SReadline.c sio.h
174SRecv.o: SRecv.c sio.h
175SRecvfrom.o: SRecvfrom.c sio.h
176SRecvmsg.o: SRecvmsg.c sio.h
177SSelect.o: SSelect.c sio.h
178SSend.o: SSend.c sio.h
179SSendto.o: SSendto.c sio.h
180SSendtoByName.o: SSendtoByName.c sio.h
181SWrite.o: SWrite.c sio.h
182SWait.o: SWait.c sio.h
183SocketUtil.o: SocketUtil.c sio.h
184StrAddr.o: StrAddr.c sio.h
185UAcceptA.o: UAcceptA.c sio.h usio.h
186UAcceptS.o: UAcceptS.c sio.h usio.h
187UBind.o: UBind.c sio.h usio.h
188UConnect.o: UConnect.c sio.h usio.h
189UConnectByName.o: UConnectByName.c sio.h usio.h
190UNew.o: UNew.c sio.h usio.h
191URecvfrom.o: URecvfrom.c sio.h usio.h
192USendto.o: USendto.c sio.h usio.h
193USendtoByName.o: USendtoByName.c sio.h usio.h
194main.o: main.c sio.h
195