File: Makefile

package info (click to toggle)
libtemplates-parser 11.10-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,200 kB
  • ctags: 428
  • sloc: ada: 11,296; python: 634; makefile: 324; sh: 37
file content (188 lines) | stat: -rw-r--r-- 5,973 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
############################################################################
#                              Ada Web Server                              #
#                                                                          #
#                     Copyright (C) 2003-2015, AdaCore                     #
#                                                                          #
#  This is free software;  you can redistribute it  and/or modify it       #
#  under terms of the  GNU General Public License as published  by the     #
#  Free Software  Foundation;  either version 3,  or (at your option) any  #
#  later version.  This software 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     #
#  General Public License for  more details.                               #
#                                                                          #
#  You should have  received  a copy of the GNU General  Public  License   #
#  distributed  with  this  software;   see  file COPYING3.  If not, go    #
#  to http://www.gnu.org/licenses for a complete copy of the license.      #
############################################################################

VERSION	= 11.10.1

DEBUG        = false
TP_TASKING   = Standard_Tasking
PROCESSORS   = 0
HOST	     = $(shell gcc -dumpmachine)
TARGET	     = $(shell gcc -dumpmachine)
prefix	     = $(dir $(shell which gnatls))..
DEFAULT_LIBRARY_TYPE	= static

ENABLE_STATIC = true
ENABLE_SHARED =$(shell $(GNAT) make -c -q -p -XTARGET=$(TARGET) \
			-Pconfig/setup/test_shared 2>/dev/null && echo "true")

ifeq ($(shell gnat ls -Pxmlada_dom 2>&1 | grep 'project file .* not found'),)
TP_XMLADA    = Installed
else
TP_XMLADA    = Disabled
endif

-include makefile.setup

ifeq ($(HOST), $(TARGET))
IS_CROSS	= false
GPROPTS		=
TPREFIX=$(DESTDIR)$(prefix)
else
IS_CROSS	= true
GPROPTS		= --target=$(TARGET)
TPREFIX=$(DESTDIR)$(prefix)/$(TARGET)
endif

MODE		= $(if $(filter-out true,$(DEBUG)),release,debug)
SDIR		= $(TARGET)/$(MODE)

GNAT		= gnat
GPRBUILD	= gprbuild
GPRINSTALL	= gprinstall

#  Install directories

ifeq (${OS}, Windows_NT)
EXEEXT	= .exe
else
EXEEXT	=
endif

#  Compute the default library kind, and possibly the other that are to
#  be built.

ifeq ($(DEFAULT_LIBRARY_TYPE),static)
ifneq ($(ENABLE_STATIC),true)
$(error static not enabled, cannot be the default)
else
ifeq ($(ENABLE_SHARED),true)
OTHER_LIBRARY_TYPE	= relocatable
endif
endif

else
ifneq ($(ENABLE_SHARED),true)
$(error shared not enabled, cannot be the default)
else
ifeq ($(ENABLE_STATIC),true)
OTHER_LIBRARY_TYPE	= static
endif
endif
endif

ifeq ($(DEBUG), true)
PRJ_BUILD=Debug
else
PRJ_BUILD=Release
endif

ifeq ($(TP_XMLADA),)
TP_XMLADA=Disabled
endif

ALL_OPTIONS = INCLUDES="$(INCLUDES)" PRJ_BUILD="$(PRJ_BUILD)" SDIR="$(SDIR)" \
		TP_XMLADA="$(TP_XMLADA)" GNAT="$(GNAT)" \
		PRJ_BUILD="$(PRJ_BUILD)" TARGET="$(TARGET)" \
		DEFAULT_LIBRARY_TYPE="$(DEFAULT_LIBRARY_TYPE)" \
		ENABLE_SHARED="$(ENABLE_SHARED)" \
		ENABLE_STATIC="$(ENABLE_STATIC)" \
		GPRBUILD="$(GPRBUILD)"

GPROPTS += -XPRJ_BUILD=$(PRJ_BUILD) -XTP_XMLADA=$(TP_XMLADA) \
		-XPROCESSORS=$(PROCESSORS) -XTARGET=$(TARGET) \
		-XVERSION=$(VERSION)

GPR_DEFAULT = -XLIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE) \
		-XXMLADA_BUILD=$(DEFAULT_LIBRARY_TYPE)
GPR_OTHER   = -XLIBRARY_TYPE=$(OTHER_LIBRARY_TYPE) \
		-XXMLADA_BUILD=$(OTHER_LIBRARY_TYPE)

#######################################################################
#  build

build: tp_xmlada.gpr
	$(GPRBUILD) -p $(GPROPTS) $(GPR_DEFAULT) \
		--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) -Ptemplates_parser
ifneq ($(OTHER_LIBRARY_TYPE),)
	$(GPRBUILD) -p $(GPROPTS) $(GPR_OTHER) \
		--subdirs=$(SDIR)/$(OTHER_LIBRARY_TYPE) -Ptemplates_parser
endif
	$(GPRBUILD) -p $(GPROPTS) $(GPR_DEFAULT) \
		--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) -Ptools/tools

run_regtests test: build
	$(MAKE) -C regtests $(ALL_OPTIONS) test

DOC_FORMATS := html latexpdf
build-doc: tp_xmlada.gpr
	$(MAKE) -C docs $(ALL_OPTIONS) $(DOC_FORMATS)
	echo Templates_Parser Documentation built with success.

#######################################################################
#  setup

tp_xmlada.gpr: setup

setup:
ifeq ($(TP_XMLADA), Installed)
	cp config/tp_xmlada_installed.gpr tp_xmlada.gpr
else
	cp config/tp_xmlada_dummy.gpr tp_xmlada.gpr
endif
	echo "prefix=$(prefix)" > makefile.setup
	echo "DEFAULT_LIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE)" >> makefile.setup
	echo "ENABLE_STATIC=$(ENABLE_STATIC)" >> makefile.setup
	echo "ENABLE_SHARED=$(ENABLE_SHARED)" >> makefile.setup
	echo "DEBUG=$(DEBUG)" >> makefile.setup
	echo "PROCESSORS=$(PROCESSORS)" >> makefile.setup
	echo "TP_XMLADA=$(TP_XMLADA)" >> makefile.setup
	echo "TARGET=$(TARGET)" >> makefile.setup

#######################################################################
#  install

install-clean:
ifneq (,$(wildcard $(TPREFIX)/share/gpr/manifests/templates_parser))
	-$(GPRINSTALL) $(GPROPTS) --uninstall \
		--prefix=$(TPREFIX) templates_parser
endif

install: install-clean
	$(GPRINSTALL) $(GPROPTS) -p -f $(GPR_DEFAULT) \
		--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) \
		--prefix=$(TPREFIX) -Ptemplates_parser
ifneq ($(OTHER_LIBRARY_TYPE),)
	$(GPRINSTALL) $(GPROPTS) -p -f $(GPR_OTHER) \
		--prefix=$(TPREFIX) --build-name=$(OTHER_LIBRARY_TYPE) \
		--subdirs=$(SDIR)/$(OTHER_LIBRARY_TYPE) -Ptemplates_parser
endif
	$(GPRINSTALL) $(GPROPTS) -p -f $(GPR_DEFAULT) \
		--prefix=$(TPREFIX) --mode=usage \
		--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) \
		--install-name=templates_parser -Ptools/tools

#######################################################################
#  clean

clean:
 # templates_parser.gpr and tools/tools.gpr store their results into
 # .build, removed below.
	$(MAKE) -C docs clean $(ALL_OPTIONS)
	$(MAKE) -C regtests clean $(ALL_OPTIONS)
	rm -fr .build makefile.setup
	rm -f config/setup/foo.ali config/setup/foo.o tp_xmlada.gpr