File: Makefile

package info (click to toggle)
gnade 1.6.2-8
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 8,220 kB
  • ctags: 847
  • sloc: ada: 40,154; sh: 4,124; sql: 3,590; makefile: 1,372; xml: 120; awk: 29
file content (353 lines) | stat: -rw-r--r-- 12,276 bytes parent folder | download | duplicates (2)
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
## ----------------------------------------------------------------------------
##                                                                           --
##  Filename        : $Source: /cvsroot/gnade/gnade/Makefile,v $
##  Description     : The top level makefile of GNADE                        --
##  Author          : Michael Erdmann <Michael.Erdmann@snafu.de>             --
##  Created On      : 03-Jan-2001                                            --
##  Last Modified By: $Author: merdmann $                                    --
##  Last Modified On: $Date: 2006/12/12 19:02:11 $                           --
##  Status          : $State: Exp $                                          --
##                                                                           --
##  Copyright (C) 2000-2006 Michael Erdmann                                  --
##                                                                           --
##  GNADE is copyrighted by the persons and institutions enumerated in the   --
##  AUTHORS file. This file is located in the root directory of the          --
##  GNADE distribution.                                                      --
##                                                                           --
##  GNADE is free software;  you can redistribute it  and/or modify it under --
##  terms of the  GNU General Public License as published  by the Free Soft- --
##  ware  Foundation;  either version 2,  or (at your option) any later ver- --
##  sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
##  OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
##  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
##  for  more details.  You should have  received  a copy of the GNU General --
##  Public License  distributed with GNAT;  see file COPYING.  If not, write --
##  to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
##  MA 02111-1307, USA.                                                      --
##                                                                           --
##  As a special exception,  if other files  instantiate  generics from      --
##  GNADE Ada units, or you link GNADE Ada units or libraries with other     --
##  files  to produce an executable, these  units or libraries do not by     --
##  itself cause the resulting  executable  to  be covered  by the  GNU      --
##  General  Public  License.  This exception does not however invalidate    --
##  any other reasons why  the executable file  might be covered by the      --
##  GNU Public License.                                                      --
##                                                                           --
##  GNADE is implemented to work with GNAT, the GNU Ada compiler.            --
##                                                                           --
## ----------------------------------------------------------------------------
##
##  Functional Description
##  ======================
##  This makefile recursively visits subdirectories for the various GNADE
##  components and performs the make steps there.
##
##  All objects exported by this project are compiled in the source tree
##  and copied into the following export directories:
##
##   <arch>-bin    	- All executables
##   <arch>-lib    	- All libraries
##   <arch>-include	- All includes as for example *.ali, *.ads and *.adb
##			  files.
##   <arch>-doc	        - All documentation
##   <arch>-export	- All package exported by the project. The setup installer
##			  for windows and the rpm files will be stored here.
##   <arch>-libexec	- All tools which are called only from within GNADE
##   shared		- All objects to be installed by the end used localy.
##
##  The Makefile provides the following target:
##
##  make all       - makes the whole GNADE project including  the samples
##		     if configured.
##  make clean     - Removes all compilation product from the GNADE file
##		     tree but leaves the compilation results intact
##  make distclean - Removes all compilation results from the file tree and
##		     the common directories <platform>-bin/-include/...
##  make dist      - Create a distribution based on the information as it
##                   is stored in the VERSION file.
##
##  make createuser- Creates a data base user. This traget has been specified
##                   here, because for some data bases it has to be executed
##                   using a different user id.
##
##  make createdb  - Create the used database
##
##  The behaviour of the Makefiles depends on the parameter COMPLETE. If it is
##  set to any value, the makefiles called from the makefile are compiling 
##  only locally in the working directory and a make install needs to be issued
##  manually to copy the compilation results into the export directories.
##
##  If a make clean is done in one of the called makefiles, the compliation 
##  results are deleted from the export directories.
##
##  The sub makefiles have to process the following targets:
##
##    all build  - To Build the targets of the subproject
##    clean	 - Clean locally all compilation results including the results
##		   in the export directories. If the Variable EXPORT is set
##		   do not delete the results in the export files. 
##    install    - Copy the local compilation results into the export directories
##  
##
##
##
##  Note:
##    The sample database is only generated on systems, where the
##    one of the supported databases is available.
##
##  Restrictions
##  ============
##  None
##
##  References
##  ==========
##  None
##
.PHONY: clean reatedb createuser directories dist-Linux dist-binaries \
	dist-win32 dist distclean documentation install manual publish \
	remove-directories removedb removeuser shared-all shared-clean

sinclude make.conf

ifeq ($(GNADETARGET),)
ROOT=$(prefix)
else
ROOT=$(GNADETARGET)
endif

DISTNAME=gnade-src-$(VERSION)

##
## This line dfines the logging method
##
LOGFILE=build.log

ifneq ($(LOGFILE),)
logging=>>$(LOGFILE)
else
logging=
endif

##
## list of directories which are created by the makefile to export build
## results.
##
exportdirs=$(libdir) 	\
	$(includedir) 	\
	$(bindir) 	\
	$(docdir) 	\
	$(SHARED) 	\
	$(DBPATH) 	\
	$(libexec) 	\
	$(gnadeetcdir)	\
	$(exportdir)


## ############################################################################ ##
##  			Compile the GNADE sources                               ##
## ############################################################################ ##
all clean ::
ifeq ($(BUILDENV),)
	@echo "*** ERROR: run the configure script before trying to build GNADE"
	exit 1
endif
	$(MAKE) core-$@ $(logging)
	$(MAKE) odbc-$@ $(logging)
	$(MAKE) native-$@ $(logging)
	$(MAKE) samples-$@ $(logging)


clean ::
	-$(RM) $(LOGFILE)

##
## core components needed in any configuration
##
core-all core-clean:
	$(MAKE) -C./cfg $(subst core-,,$@)  Target=$(libexec) EXPORT=T
	$(MAKE) -C./etc $(subst core-,,$@)  EXPORT=T
	$(MAKE) -C./support EXPORT=T $(subst core-,,$@)
	$(MAKE) -C./bin     EXPORT=T $(subst core-,,$@)
##
## All odbc related and dependant parts of GNADE
##
odbc-all odbc-clean ::
ifneq ($(OPTODBC),) 
	$(MAKE) -C./dbi     BINDINGS=odbc EXPORT=T $(subst odbc-,,$@)
	$(MAKE) -C./esql    EXPORT=T $(subst odbc-,,$@)
	$(MAKE) -C./tools   EXPORT=T $(subst odbc-,,$@)
	$(MAKE) -C./samples SAMPLES="esql odbc" $(subst odbc-,,$@)
else
	@echo "ODBC Bindings not build"
endif

##
## All native database bindings except for odbc
##
native-all native-clean ::
ifneq ($(NATIVE_BINDINGS),)
	$(MAKE) -C./dbi BINDINGS="$(NATIVE_BINDINGS)" EXPORT=T $(subst native-,,$@)

else
	@echo "Native bindings are not build"
endif

##
## The samples
##
samples-all samples-clean :
	$(MAKE) -C./samples SAMPLES="$(NATIVE_SAMPLES)" $(subst samples-,,$@)

##
## Generate the configured basic project file for gnade
##
$(TARGET)gnade.gpr: gnade.gpp
	$(PREP) -s DMLINKEROPT="$(DMLINKEROPT)"  			\
		    NALINKEROPT="$(APP_LINK_FLAGS_NATIVE)"		\
		    ROOT=$(ROOT)	 				\
		    BUILDARCH=$(BUILDARCH)				\
		   gnade.gpp $(TARGET)gnade.gpr

all::
	$(MAKE) gnade.gpr

##
## Generate commonly resources
##
shared-all:
	$(CP) $(subst /,$(PATHSEP),./ide/gps/*.xml)   $(subst /,$(PATHSEP), $(SHARED))
	$(CP) $(subst /,$(PATHSEP),./doc/build/*.xml) $(subst /,$(PATHSEP), $(SHARED)) 
	$(MAKE) GNADETARGET=/usr/local/gnade TARGET=$(SHARED)/ \
		APP_LINK_FLAGS_NATIVE="-L$(SITE_LIBDIR) $(GNADE_LIBS)" \
		$(SHARED)/gnade.gpr 

shared-clean:

##
## create/delete the export directories
##
directories:
	-$(MKDIR) $(subst /,$(PATHSEP),$(exportdirs)) 2> configure.log

remove-directories:
	-$(RMDIR) $(subst /,$(PATHSEP),$(exportdirs)) 2>configure.log

##
## Create the documentation
##
documentation : $(DOCUMENT_PARTS)

manual:
	echo $(DOCUMENT_PARTS)
	$(MAKE) -C doc/build documentation
## ############################################################################ ##
## create a distribution package different operating system.                    ##
## ############################################################################ ##
dist :: all
	$(MAKE) dist-binaries
	$(MAKE) documentation
	$(MAKE) package

package :: 
	$(MAKE) package-$(BUILDENV)
	$(MAKE) package-clean-$(BUILDENV) 

# copy the binries into the lib 
dist-binaries:
	strip $(libexec)/prep$(bin) 
	strip $(wildcard $(bindir)/*$(bin))

## Build all packages which could be build by a GNU development environment
package-gnu: dist-tree $(foreach i,$(PACKAGE_TYPES),package-$i)

dist-tree: clean
	rm -rf $(DISTNAME)
	mkdir -p $(DISTNAME)
	mkdir -p $(DISTNAME)/doc
	mkdir -p $(DISTNAME)/doc/releasenotes
	tar cvf $(DISTNAME)/files.tar --files-from=MANIFEST
	( cd $(DISTNAME) && tar xvf files.tar && rm files.tar )	
	cp -a  ./doc/releasenotes/note_$(VERSION).html $(DISTNAME)/doc/releasenotes
	cp -a  $(docdir)/* $(DISTNAME)/doc

package-gzip:
	tar cvfz $(DISTNAME).tar.gz $(DISTNAME)
	mv $(DISTNAME).tar.gz $(exportdir)
	rm -rf $(DISTNAME)

package-zip:
	zip -r $(exportdir)/$(DISTNAME).zip $(DISTNAME)		

package-rpm:
	@echo "*** Execute the makefile in ./rpm as superuser ****" 

package-clean-gnu:
	$(RM) $(DISTNAME)

## Build a windows/dos distribution
package-win32: clean
	cmd /c "C:\Programme\Inno Setup 4\iscc" win32\gnade.iss >var/build.log
	$(CP) $(subst /,$(PATHSEP),Output/setup.exe $(exportdir)/setup-gnade-$(VERSION).exe)
	$(RMDIR) Output

package-clean-win32:

## ############################################################################ ##
## Create the test database 
## ############################################################################ ##
createdb createuser removeuser removedb:
	$(MAKE) -C./samples/sample_db DATABASE=$(DATABASE) $@

## ############################################################################ ##
## install the sofware in the system
## ############################################################################ ##
install :: shared-all 
	./bin/gnadeinst.sh --force

## ############################################################################ ##
## CLEANUP SECTION                                                              ##
## ############################################################################ ##

##
## clean up the  distribution
##
distclean :: clean clean-standalone
	$(MAKE) remove-directories
	$(RM) gnade.gpr
	$(RM) make.conf
	$(RM) gnade-*.*.tar.gz
	$(RM) gnade-*.*.zip
	$(RM) config.* *~ .configure configure.log
##
## Cleanup some subdirs but no all!
##
clean ::
ifeq ($(BUILDENV),gnu)
	$(MAKE) -C./autoconf $@
	$(MAKE) -C./pkg-config $@
	$(MAKE) -C./cfg $@
	$(MAKE) -C./bin $@
endif
##
## Perfom a local clean up
##
clean ::
	$(MAKE) -C./cfg clean
	$(RM) *~*~ *~

##
## clean out the standalone example. This example does not know anything
## about the operating system.
##
clean-standalone:
	$(RM) $(subst /,$(PATHSEP),samples/standalone/*.ali)
	$(RM) $(subst /,$(PATHSEP),samples/standalone/*.o)
	$(RM) $(subst /,$(PATHSEP),samples/standalone/*~*~)
	$(RM) $(subst /,$(PATHSEP),samples/standalone/*~)

##
## publish towards sourceforge
##
publish:
	-ncftpput  upload.sourceforge.net  /incoming $(exportdir)/$(DISTNAME).zip
	-ncftpput  upload.sourceforge.net  /incoming $(exportdir)/$(DISTNAME).tar.gz