Project

General

Profile

Bug #8115 ยป Makefile

vo.x (Vit Ondruch), 04/11/2013 12:16 AM

 
1

    
2
SHELL = /bin/sh
3

    
4
# V=0 quiet, V=1 verbose.  other values don't work.
5
V = 1
6
Q1 = $(V:1=)
7
Q = $(Q1:0=@)
8
ECHO1 = $(V:1=@:)
9
ECHO = $(ECHO1:0=@echo)
10

    
11
#### Start of system configuration section. ####
12

    
13
srcdir = .
14
topdir = $(DESTDIR)/usr/include
15
hdrdir = $(topdir)
16
arch_hdrdir = $(archincludedir)
17
PATH_SEPARATOR = :
18
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
19
prefix = /usr
20
rubysitearchprefix = $(sitearchlibdir)/$(RUBY_BASE_NAME)
21
rubyarchprefix = $(exec_prefix)/lib64/$(RUBY_BASE_NAME)
22
rubylibprefix = $(exec_prefix)/share/$(RUBY_BASE_NAME)
23
exec_prefix = $(prefix)
24
vendorarchhdrdir = $(vendorhdrdir)/$(arch)
25
sitearchhdrdir = $(sitehdrdir)/$(arch)
26
rubyarchhdrdir = $(archincludedir)
27
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
28
sitehdrdir = $(rubyhdrdir)/site_ruby
29
rubyhdrdir = $(DESTDIR)/usr/include
30
rubygemsdir = $(DESTDIR)/usr/share/rubygems
31
vendorarchdir = $(DESTDIR)/usr/lib64/ruby/vendor_ruby
32
vendorlibdir = $(vendordir)/$(ruby_version)
33
vendordir = $(DESTDIR)/usr/share/ruby/vendor_ruby
34
sitearchdir = $(DESTDIR)/usr/local/lib64/ruby/site_ruby
35
sitelibdir = $(sitedir)/$(ruby_version)
36
sitedir = $(DESTDIR)/usr/local/share/ruby/site_ruby
37
rubyarchdir = $(rubyarchprefix)/$(ruby_version)
38
rubylibdir = $(rubylibprefix)/$(ruby_version)
39
sitearchincludedir = $(includedir)/$(sitearch)
40
archincludedir = $(includedir)/$(arch)
41
sitearchlibdir = $(libdir)/$(sitearch)
42
archlibdir = $(libdir)/$(arch)
43
ridir = $(datarootdir)/$(RI_BASE_NAME)
44
mandir = $(DESTDIR)/usr/share/man
45
localedir = $(datarootdir)/locale
46
libdir = $(DESTDIR)/usr/lib64
47
psdir = $(docdir)
48
pdfdir = $(docdir)
49
dvidir = $(docdir)
50
htmldir = $(docdir)
51
infodir = $(DESTDIR)/usr/share/info
52
docdir = $(datarootdir)/doc/$(PACKAGE)
53
oldincludedir = /usr/include
54
includedir = $(DESTDIR)/usr/include
55
localstatedir = $(DESTDIR)/var
56
sharedstatedir = $(DESTDIR)/var/lib
57
sysconfdir = $(DESTDIR)/etc
58
datadir = $(DESTDIR)/usr/share
59
datarootdir = $(prefix)/share
60
libexecdir = $(DESTDIR)/usr/libexec
61
sbindir = $(DESTDIR)/usr/sbin
62
bindir = $(DESTDIR)/usr/bin
63
archdir = $(rubyarchdir)
64

    
65

    
66
CC = gcc
67
CXX = g++
68
LIBRUBY = $(LIBRUBY_SO)
69
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
71
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
72
empty =
73
OUTFLAG = -o $(empty)
74
COUTFLAG = -o $(empty)
75

    
76
RUBY_EXTCONF_H = 
77
cflags   =  $(optflags) $(debugflags) $(warnflags)
78
optflags = -O3 -fno-fast-math
79
debugflags = -ggdb3
80
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration
81
CFLAGS   = -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4  -m64 -mtune=generic $(ARCH_FLAG)
82
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
83
DEFS     = 
84
CPPFLAGS = -DHAVE_MYSQL_SSL_SET -DHAVE_RB_STR_SET_LEN -DHAVE_MYSQL_H  $(DEFS) $(cppflags) -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4  -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fPIC  -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1
85
CXXFLAGS = $(CFLAGS) -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic
86
ldflags  = -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic
87
dldflags =  
88
ARCH_FLAG = -m64
89
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
90
LDSHARED = $(CC) -shared
91
LDSHAREDXX = $(CXX) -shared
92
AR = ar
93
EXEEXT = 
94

    
95
RUBY_INSTALL_NAME = ruby
96
RUBY_SO_NAME = ruby
97
RUBYW_INSTALL_NAME = 
98
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
99
RUBYW_BASE_NAME = rubyw
100
RUBY_BASE_NAME = ruby
101

    
102
arch = x86_64-linux
103
sitearch = $(arch)
104
ruby_version = 
105
ruby = $(bindir)/ruby
106
RUBY = $(ruby)
107
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
108

    
109
RM = rm -f
110
RM_RF = $(RUBY) -run -e rm -- -rf
111
RMDIRS = rmdir --ignore-fail-on-non-empty -p
112
MAKEDIRS = /usr/bin/mkdir -p
113
INSTALL = /usr/bin/install -c
114
INSTALL_PROG = $(INSTALL) -m 0755
115
INSTALL_DATA = $(INSTALL) -m 644
116
COPY = cp
117
TOUCH = exit >
118

    
119
#### End of system configuration section. ####
120

    
121
preload = 
122

    
123
libpath = . $(libdir)
124
LIBPATH =  -L. -L$(libdir)
125
DEFFILE = 
126

    
127
CLEANFILES = mkmf.log
128
DISTCLEANFILES = 
129
DISTCLEANDIRS = 
130

    
131
extout = 
132
extout_prefix = 
133
target_prefix = 
134
LOCAL_LIBS = 
135
LIBS = $(LIBRUBYARG_SHARED) -L/usr/lib64/mysql -lmysqlclient -lpthread -lz -lm -lssl -lcrypto -ldl  -lpthread -lrt -ldl -lcrypt -lm   -lc
136
ORIG_SRCS = mysql.c
137
SRCS = $(ORIG_SRCS) 
138
OBJS = mysql.o
139
HDRS = $(srcdir)/error_const.h
140
TARGET = mysql
141
TARGET_NAME = mysql
142
TARGET_ENTRY = Init_$(TARGET_NAME)
143
DLLIB = $(TARGET).so
144
EXTSTATIC = 
145
STATIC_LIB = 
146

    
147
BINDIR        = $(DESTDIR)$(bindir)
148
RUBYCOMMONDIR = $(DESTDIR)$(vendordir)$(target_prefix)
149
RUBYLIBDIR    = $(DESTDIR)$(vendorlibdir)$(target_prefix)
150
RUBYARCHDIR   = $(DESTDIR)$(vendorarchdir)$(target_prefix)
151
HDRDIR        = $(DESTDIR)$(rubyhdrdir)/ruby$(target_prefix)
152
ARCHHDRDIR    = $(DESTDIR)$(rubyhdrdir)/$(arch)/ruby$(target_prefix)
153

    
154
TARGET_SO     = $(DLLIB)
155
CLEANLIBS     = $(TARGET).so 
156
CLEANOBJS     = *.o  *.bak
157

    
158
all:    $(DLLIB)
159
static: $(STATIC_LIB)
160
.PHONY: all install static install-so install-rb
161
.PHONY: clean clean-so clean-static clean-rb
162

    
163
clean-static::
164
clean-rb-default::
165
clean-rb::
166
clean-so::
167
clean: clean-so clean-static clean-rb-default clean-rb
168
		-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
169

    
170
distclean-rb-default::
171
distclean-rb::
172
distclean-so::
173
distclean-static::
174
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
175
		-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
176
		-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
177
		-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
178

    
179
realclean: distclean
180
install: install-so install-rb
181

    
182
install-so: $(DLLIB) ./.RUBYARCHDIR.time
183
	$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
184
clean-static::
185
	-$(Q)$(RM) $(STATIC_LIB)
186
install-rb: pre-install-rb install-rb-default
187
install-rb-default: pre-install-rb-default
188
pre-install-rb: Makefile
189
pre-install-rb-default: Makefile
190
pre-install-rb-default:
191
	$(ECHO) installing default mysql libraries
192
./.RUBYARCHDIR.time:
193
	$(Q) $(MAKEDIRS) $(RUBYARCHDIR)
194
	$(Q) $(TOUCH) $@
195

    
196
site-install: site-install-so site-install-rb
197
site-install-so: install-so
198
site-install-rb: install-rb
199

    
200
.SUFFIXES: .c .m .cc .mm .cxx .cpp .C .o
201

    
202
.cc.o:
203
	$(ECHO) compiling $(<)
204
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
205

    
206
.mm.o:
207
	$(ECHO) compiling $(<)
208
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
209

    
210
.cxx.o:
211
	$(ECHO) compiling $(<)
212
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
213

    
214
.cpp.o:
215
	$(ECHO) compiling $(<)
216
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
217

    
218
.C.o:
219
	$(ECHO) compiling $(<)
220
	$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
221

    
222
.c.o:
223
	$(ECHO) compiling $(<)
224
	$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
225

    
226
.m.o:
227
	$(ECHO) compiling $(<)
228
	$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
229

    
230
$(DLLIB): $(OBJS) Makefile
231
	$(ECHO) linking shared-object $(DLLIB)
232
	-$(Q)$(RM) $(@)
233
	$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
234

    
235

    
236

    
237
$(OBJS): $(HDRS) $(ruby_headers)