File: Makefile.Linux

package info (click to toggle)
yiff 2.06-3
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,464 kB
  • ctags: 3,028
  • sloc: ansic: 47,463; makefile: 218; sh: 77
file content (188 lines) | stat: -rw-r--r-- 5,330 bytes parent folder | download
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# ########################################################################
#
#                       Makefile for libY2
#
#   Rules:
#
#	all	-- builds library.
#	install -- installs library.
#	clean	-- remove object and other work files.
#


# ########################################################################
# Install Options:
#
PREFIX = /usr


# ########################################################################
# Library Name and Version:
#
#   Note, do not change major version number. That would imply that the
#   entire Y protocol has changed.
#
LIBPFX = libY2
LIBVER = 2


# ########################################################################
# Compiler Flags:
#   
#   These are definations to enable or disable certain compile time
#   options. Omitting a defination turns that option off.
#
#   Each argument is of the format -D<option> where <option> is
#   one of the following:
#
#	* None available *
#
#   Other arguments include:
#
#       -O#                     Specifies the optimization level the
#                               compiler is to compile at. This (attempts)
#                               to improve the efficiency of the generated
#                               program when it runs. Available values for
#                               # are from 0 to 2 (some compilers allow
#                               higher values). When in doubt, set # to 2.
#
#       -g                      Compile with debugging information,
#                               this is useful for determining why this
#                               program (if it did) crash. However this
#                               may hinder performance, so don't use
#                               this option unless you are attempting
#                               to debug the program.
#
#	-shared			Compile this program as a shared library.
#
CFLAGS  = -Wall -O2
ARFLAGS = cru


# ########################################################################
# Dependant Libraries:
#
#   These are dynamic (sometimes called shared) libraries that this
#   program is to be `linked' to.
#
#   Each argument is of the format -l<name> where <name> is the name
#   of the library. You may have to add one or more -l<name> arguments
#   to the LIB line depending on what you have set in the CFLAGS line
#   farther above.
#       
LIB =

# Library Directories:
#
#   All libraries are looked for in the directories specified below.
# 
#   Each argument is of the format -L<dir> where <dir> is the full
#   path to the directory.
#
LIB_DIR =

# Header File Directories:
#
#   Required header files that are not in the standard locations are
#   searched for in the directories specified below.
#
#   Each argument is of the format -I<dir> where <dir> is the full
#   path to the directory.
#
INC =


# ########################################################################
# Program Source and Header Files:
#
include Makefile.srclist

CC = gcc


# ########################################################################
# Build Rules:
#
#all:
#	$(CC) $(SRC) $(CFLAGS) $(LIB) $(LIB_DIR) -o $(LIBPFX).so.$(LIBVER)

all: $(SRC:%.c=%.o)
	$(AR) $(ARFLAGS) $(LIBPFX).a $(SRC:%.c=%.o)
	$(CC) $(SRC) $(CFLAGS) $(LIB) $(LIB_DIR) -shared -fPIC -DPIC -Wl,-soname -Wl,$(LIBPFX).so.$(LIBVER) -o $(LIBPFX).so.$(LIBVER)

%.o: %.c
	$(CC) -c $(CFLAGS) $(LIB) $(LIB_DIR) $< -o $@



# ########################################################################
# Install Rules:
#

INSTALL      = install
INSTBINFLAGS = -m 0755
INSTUIDFLAGS = -m 4755
INSTLIBFLAGS = -m 0755
INSTINCFLAGS = -m 0444
INSTMANFLAGS = -m 0444
INSTCFGFLAGS = -m 0644
INSTDATFLAGS = -m 0444

COPY      = cp
COPYFLAGS = -i -v

LINK      = ln
LINKFLAGS = -sf

MKDIR      = mkdir
MKDIRFLAGS = -p

YLIB_DIR = $(PREFIX)/lib
YINC_DIR = $(PREFIX)/include/Y2
YMAN_DIR = $(PREFIX)/man/man3


install:
	$(MKDIR) $(MKDIRFLAGS) $(YLIB_DIR)
	$(INSTALL) $(INSTLIBFLAGS) $(LIBPFX).so.$(LIBVER) $(YLIB_DIR)
	$(LINK) $(LINKFLAGS) $(LIBPFX).so.$(LIBVER) $(YLIB_DIR)/$(LIBPFX).so

	$(MKDIR) $(MKDIRFLAGS) $(YINC_DIR)
	$(INSTALL) $(INSTINCFLAGS) ../include/Y.h $(YINC_DIR)
	$(INSTALL) $(INSTINCFLAGS) ../include/Ylib.h $(YINC_DIR)
	$(INSTALL) $(INSTINCFLAGS) ../include/Yclientnet.h $(YINC_DIR)
	$(INSTALL) $(INSTINCFLAGS) ../include/Ymixercodes.h $(YINC_DIR)

	$(MKDIR) $(MKDIRFLAGS) $(YMAN_DIR)
	$(INSTALL) $(INSTMANFLAGS) man/* $(YMAN_DIR)

	@echo "---------------------------------------------------------------"
	@echo "Library $(LIBPFX) installed in:"
	@echo " "
	@echo "        $(YLIB_DIR)"
	@echo " "
	@echo "Header files are installed in:"
	@echo " "
	@echo "        $(YINC_DIR)"
	@echo " "
	@echo "Manual pages are installed in:"
	@echo " "
	@echo "        $(YMAN_DIR)"
	@echo " "
	@echo "To link your programs to this library add -lY2 to the compiler"
	@echo "command."
	@echo " "
	@echo "You may also need to recompile some programs which are linked"
	@echo "to this program in case of protocol value changes. Modification"
	@echo "to their code is unnessasary if the major version number matches."
	@echo " "


# ########################################################################
# Maintainance and Misc Rules:
#
clean:
	rm -f a.out core *.o $(LIBPFX).so.$(LIBVER) $(LIBPFX).a


# ########################################################################