File: Makefile

package info (click to toggle)
tcp4u 3.3.1-7
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,120 kB
  • ctags: 760
  • sloc: ansic: 3,096; makefile: 150; sh: 24
file content (95 lines) | stat: -rw-r--r-- 2,484 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# -------------------------------------------------------------------------
# Makefile for Tcp4u Library
# -------------------------------------------------------------------------
# 
# To be changed :
# DESTDIR       : The destination directory
# COMPIL_FLAGS  : Compilation directives (-g, -O, ...)
# 
# Use : 
#     make install
#
## Modified for Debian GNU/Linux package   Dirk Eddelbuettel <edd@debian.org> 

DESTDIR      = ../Unix/
#COMPIL_FLAGS = -g
COMPIL_FLAGS = -O2 -D_REENTRANT


# SunOS: AR should be declared as ar r
AR      = ar -r
# AR      = ar r

INSTALL = cp -p
RM      = rm -f


#################################
# DO NOT CHANGE UNDER THIS LINE
#################################

LIB_NAME       = tcp4ux
TEST_DIRECTORY = test_directory
#DEFINES        = -DUNIX -D`../Unix/OSname`
DEFINES        = -DUNIX -DLinux
TCP4U_INC      = ../Include


INCLUDES     = -I$(TCP4U_INC)
HTTP4U_OBJS  = http4u.o htp4_url.o htp4_err.o util.o
TCP4U_OBJS   = tcp4u.o tcp4_err.o tcp4_log.o tcp4u_ex.o \
                      skt4u.o tn4u.o tn_proto.o
UDP4U_OBJS   = udp4u.o
SMTP4U_OBJS  = smtp4u.o
OBJS         = $(HTTP4U_OBJS) $(TCP4U_OBJS) $(UDP4U_OBJS) $(SMTP4U_OBJS)
CFLAGS       = $(COMPIL_FLAGS) $(DEFINES) $(INCLUDES)

LIB_NAME       	= tcp4u
LIBMAJOR	= 3
LIBMINOR	= 3
SHAREDLIB    	:= lib$(LIB_NAME).so.$(LIBMAJOR).$(LIBMINOR)
LIBSONAME	:= lib$(LIB_NAME).so.$(LIBMAJOR)
SHAREDOBJS   	:= $(subst .o,.O,$(OBJS))

%.O : %.c
	$(CC) -fPIC $(CFLAGS) -c $< -o $@


#################################
#all:: $(TEST_DIRECTORY) lib$(LIB_NAME).a 
all:: lib$(LIB_NAME).a lib$(LIB_NAME)$(LIBMAJOR).so

lib$(LIB_NAME)$(LIBMAJOR).so: $(SHAREDOBJS)
	gcc -shared -Wl,-soname,$(LIBSONAME) -o $(SHAREDLIB) $(SHAREDOBJS) -lc
	ln -sf $(SHAREDLIB) $(LIBSONAME)
	ln -sf $(SHAREDLIB) lib$(LIB_NAME).so

lib$(LIB_NAME).a: $(OBJS)
	$(RM) $@
	$(AR) $@ $(OBJS)
	ranlib $@

install:: $(TEST_DIRECTORY) lib$(LIB_NAME).a
	@if [ -d $(DESTDIR) ]; then set +x; \
		else (set -x; $(MKDIRHIER) $(DESTDIR) $(DESTDIR)); fi
	$(INSTALL) $(INSTLIBFLAGS) lib$(LIB_NAME).a $(DESTDIR) 

test_directory: 
	@if [ ! -r tcp4u.c ]; then \
		echo "make must be run from the src directory"; \
		exit 1; \
	fi 
	@if [ ! -r ../Unix/OSname ]; then \
		echo "../Unix/OSname missing."; \
		exit 1; \
	else \
		chmod +x ../Unix/OSname; \
	fi 


clean::
	$(RM) $(OBJS) $(SHAREDOBJS) lib$(LIB_NAME).a lib$(LIB_NAME).so*

# -------------------------------------------------------------------------
# dependencies generated by makedepend