File: Makefile

package info (click to toggle)
cqrlib 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 160 kB
  • ctags: 80
  • sloc: ansic: 545; makefile: 146
file content (285 lines) | stat: -rw-r--r-- 7,997 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
#
#  Makefile
#  CQRlib
#
#  Created by Herbert J. Bernstein on 02/22/09.
#  Copyright 2009 Herbert J. Bernstein. All rights reserved.
#
#

#  Work supported in part by NIH NIGMS under grant 1R15GM078077-01 and DOE 
#  under grant ER63601-1021466-0009501.  Any opinions, findings, and 
#  conclusions or recommendations expressed in this material are those of the   
#  author(s) and do not necessarily reflect the views of the funding agencies.


#**********************************************************************
#*                                                                    *
#* YOU MAY REDISTRIBUTE THE CQRlib API UNDER THE TERMS OF THE LGPL    *
#*                                                                    *
#**********************************************************************/

#************************* LGPL NOTICES *******************************
#*                                                                    *
#* This library is free software; you can redistribute it and/or      *
#* modify it under the terms of the GNU Lesser General Public         *
#* License as published by the Free Software Foundation; either       *
#* version 2.1 of the License, or (at your option) any later version. *
#*                                                                    *
#* This library is distributed in the hope that it will be useful,    *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of     *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
#* Lesser General Public License for more details.                    *
#*                                                                    *
#* You should have received a copy of the GNU Lesser General Public   *
#* License along with this library; if not, write to the Free         *
#* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,    *
#* MA  02110-1301  USA                                                *
#*                                                                    *
#**********************************************************************/

# Version string
VERSION = 2:0:0
RELEASE = 1.0.3


#
# Compiler and compilation flags
#
CC	= gcc
CFLAGS  = -g -O2  -Wall -ansi -pedantic

#
# libtool path if system default is not suitable
#
#LIBTOOL = $(HOME)/bin/libtool
ifndef LIBTOOL
  LIBTOOL = libtool
endif

#
# If local headers must be quoted uncomment the next line
#
#USE_LOCAL_HEADERS = 1


#
# Directories
#
ROOT     = .
LIB      = $(ROOT)/lib
BIN      = $(ROOT)/bin
SRC      = $(ROOT)
INC      = $(ROOT)
EXAMPLES = $(ROOT)
TESTDATA = $(ROOT)
#INSTALLDIR = /usr/local
INSTALLDIR  = $(DESTDIR)/usr

#
# Include directories
#
ifdef USE_LOCAL_HEADERS
INCLUDES = -DUSE_LOCAL_HEADERS
else
INCLUDES = -I$(INC)
endif

#
# C Libraries
#
CLIBRARIES = -lm

COMPILE_COMMAND        =  $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(INCLUDES) $(WARNINGS) -c
LIBRARY_LINK_COMMAND   =  $(LIBTOOL) --mode=link  $(CC) -version-info $(VERSION) -rpath /usr/lib
BUILD_COMMAND_LOCAL    =  $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(INCLUDES)
BUILD_COMMAND_DYNAMIC  =  $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -dynamic -I $(INSTALLDIR)/include -L$(INSTALLDIR)/lib
BUILD_COMMAND_STATIC   =  $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -static -I $(INSTALLDIR)/include -L$(INSTALLDIR)/lib
INSTALL_COMMAND        =  $(LIBTOOL) --mode=install cp
INSTALL_FINISH_COMMAND =  $(LIBTOOL) --mode=finish

OBJ_EXT                =  lo
LIB_EXT                =  la

######################################################################
#  You should not need to make modifications below this line         #
######################################################################

#
# Suffixes of files to be used or built
#
.SUFFIXES:	.c .$(OBJ_EXT) .$(LIB_EXT)

#
# Common dependencies
#
COMMONDEP = Makefile

#
# Source files
#
SOURCE   =  $(SRC)/cqrlib.c

#
# Header files
#
HEADERS   =  $(INC)/cqrlib.h

# Default: instructions
#
default:
	@echo ' '
	@echo '***************************************************************'
	@echo ' '
	@echo ' PLEASE READ README_CQRlib.txt and lgpl.txt'
	@echo ' '
	@echo ' Before making the CQRlib library and example programs, check'
	@echo ' that the chosen settings are correct'
	@echo ' '
	@echo ' The current compile command is:'
	@echo ' '
	@echo '   $(COMPILE_COMMAND)'
	@echo ' '
	@echo ' The current library link command is:'
	@echo ' '
	@echo '   $(LIBRARY_LINK_COMMAND)'
	@echo ' '
	@echo ' The current library local, dynamic and static build commands are:'
	@echo ' '
	@echo '   $(BUILD_COMMAND_LOCAL)'
	@echo '   $(BUILD_COMMAND_DYNAMIC)'
	@echo '   $(BUILD_COMMAND_STATIC)'
	@echo ' '
	@echo ' Before installing the CQRlib library and example programs, check'
	@echo ' that the install directory and install commands are correct:'
	@echo ' '
	@echo ' The current values are :'
	@echo ' '
	@echo '   $(INSTALLDIR) '	
	@echo '   $(INSTALL_COMMAND) '	
	@echo '   $(INSTALL_FINISH) '	
	@echo ' '
	@echo ' To compile the CQRlib library and example programs type:'
	@echo ' '
	@echo '   make clean'
	@echo '   make all'
	@echo ' '
	@echo ' To run a set of tests type:'
	@echo ' '
	@echo '   make tests'
	@echo ' '
	@echo ' To clean up the directories type:'
	@echo ' '
	@echo '   make clean'
	@echo ' '
	@echo ' To install the library and binaries type:'
	@echo ' '
	@echo '   make install'
	@echo ' '
	@echo '***************************************************************'
	@echo ' '

#
# Compile the library and examples
#
all:	$(LIB) $(BIN) $(SOURCE) $(HEADERS) \
		$(LIB)/libCQRlib.$(LIB_EXT) \
		$(BIN)/CQRlibTest
		
install:  all $(INSTALLDIR) $(INSTALLDIR)/lib $(INSTALLDIR)/include \
          $(INC) $(LIB)/libCQRlib.$(LIB_EXT)  $(INC)/cqrlib.h
		  $(INSTALL_COMMAND) $(LIB)/libCQRlib.$(LIB_EXT) $(INSTALLDIR)/lib/libCQRlib.$(LIB_EXT)
		  $(INSTALL_FINISH_COMMAND) $(INSTALLDIR)/lib/libCQRlib.$(LIB_EXT)
		  -cp $(INSTALLDIR)/include/cqrlib.h $(INSTALLDIR)/include/CQRlib_old.h
		  cp $(INC)/cqrlib.h $(INSTALLDIR)/include/cqrlib.h
		  chmod 644 $(INSTALLDIR)/include/cqrlib.h
		  echo "Testing final install dynamic"
		  $(BUILD_COMMAND_DYNAMIC)  $(EXAMPLES)/CQRlibTest.c \
		  -lCQRlib -lm -o $(BIN)/CQRlibTest_dynamic
		  $(BIN)/CQRlibTest_dynamic > $(TESTDATA)/CQRlibTest_dynamic.lst
		  diff -b -c $(TESTDATA)/CQRlibTest_orig.lst \
		    $(TESTDATA)/CQRlibTest_dynamic.lst
		  echo "Testing final install static"
		  $(BUILD_COMMAND_STATIC) $(EXAMPLES)/CQRlibTest.c \
		   -lCQRlib -lm -o $(BIN)/CQRlibTest_static
		  $(BIN)/CQRlibTest_static > $(TESTDATA)/CQRlibTest_static.lst
		  diff -b -c $(TESTDATA)/CQRlibTest_orig.lst \
		    $(TESTDATA)/CQRlibTest_static.lst
			
		  
		  
#
# Directories
#
$(INSTALLDIR):
	mkdir -p $(INSTALLDIR)

$(INSTALLDIR)/lib:  $(INSTALLDIR)
	mkdir -p $(INSTALLDIR)/lib

$(INSTALLDIR)/bin:  $(INSTALLDIR)
	mkdir -p $(INSTALLDIR)/bin

$(INSTALLDIR)/include:  $(INSTALLDIR)
	mkdir -p $(INSTALLDIR)/include
	

$(LIB):
	mkdir $(LIB)

$(BIN):
	mkdir $(BIN)

#
# CQRlib library
#
$(LIB)/libCQRlib.$(LIB_EXT): $(SOURCE) $(HEADERS) $(COMMONDEP)
	$(COMPILE_COMMAND) -c $(SOURCE)
	$(LIBRARY_LINK_COMMAND) -o $(LIB)/libCQRlib.$(LIB_EXT) *.$(OBJ_EXT) \
		$(CLIBRARIES)

#
# CQRlibTest example program
#
$(BIN)/CQRlibTest: $(LIB)/libCQRlib.$(LIB_EXT) $(EXAMPLES)/CQRlibTest.c 
	$(BUILD_COMMAND_LOCAL) $(EXAMPLES)/CQRlibTest.c $(LIB)/libCQRlib.$(LIB_EXT) -lm \
		      -o $@

#
# Tests
#
tests:		$(LIB) $(BIN) $(BIN)/CQRlibTest \
				$(TESTDATA)/CQRlibTest_orig.lst
			$(BIN)/CQRlibTest > $(TESTDATA)/CQRlibTest.lst
			diff -b -c $(TESTDATA)/CQRlibTest_orig.lst \
				$(TESTDATA)/CQRlibTest.lst

#
# Remove all non-source files
#
empty:
		  @-rm -rf $(LIB)
		  @-rm -rf $(BIN)
		  @-rm -f $(TESTDATA)/CQRlibTest.lst
		  @-rm -f $(TESTDATA)/CQRlibTest_static.lst
		  @-rm -f $(TESTDATA)/CQRlibTest_dynamic.lst
		  @-rm -rf .libs
 
#
# Remove temporary files
#
clean:
	@-rm -f core 
	@-rm -f *.o
	@-rm -f *.$(OBJ_EXT)
	@-rm -f *.c.*

#
# Restore to distribution state
#
distclean:	clean empty