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
|
############################################################################
# Ada Web Server #
# #
# Copyright (C) 2003-2020, 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. #
############################################################################
ifndef VERBOSE_MAKE
.SILENT:
endif
VERSION = 22.0
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
GNAT := gnat
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
ifeq ($(HOST), $(TARGET))
GPROPTS =
TPREFIX=$(DESTDIR)$(prefix)
else
GPROPTS = --target=$(TARGET)
TPREFIX=$(DESTDIR)$(prefix)/$(TARGET)
endif
MODE = $(if $(filter-out true,$(DEBUG)),release,debug)
SDIR = $(TARGET)/$(MODE)
GPRBUILD = gprbuild
GPRINSTALL = gprinstall
GPRCLEAN = gprclean
# Compute the default library kind, and possibly the other that are to
# be built.
ifeq ($(DEFAULT_LIBRARY_TYPE),shared)
ifneq ($(ENABLE_SHARED),true)
$(error shared not enabled, cannot be the default)
endif
endif
ifeq ($(DEFAULT_LIBRARY_TYPE),static)
ifneq ($(ENABLE_STATIC),true)
$(error static not enabled, cannot be the default)
endif
endif
ifeq ($(ENABLE_STATIC), true)
LIBRARY_TYPES += static
endif
ifeq ($(ENABLE_SHARED), true)
LIBRARY_TYPES += relocatable static-pic
endif
ifeq ($(DEBUG), true)
PRJ_BUILD := Debug
else
PRJ_BUILD := Release
endif
ifeq ($(strip $(findstring linux, $(TARGET))),linux)
PRJ_TARGET=Linux
else
ifeq ($(strip $(findstring mingw32, $(TARGET))),mingw32)
PRJ_TARGET=Windows
else
ifeq ($(strip $(findstring cygwin, $(TARGET))),cygwin)
PRJ_TARGET=Windows
else
ifeq ($(strip $(findstring darwin, $(TARGET))),darwin)
PRJ_TARGET=macOS
else
ifeq ($(strip $(findstring freebsd, $(TARGET))),freebsd)
PRJ_TARGET=FreeBSD
else
PRJ_TARGET=UNIX
endif
endif
endif
endif
endif
-include makefile.setup
ALL_OPTIONS := \
DEBUG \
DEFAULT_LIBRARY_TYPE \
ENABLE_SHARED \
ENABLE_STATIC \
GNAT \
GPRBUILD \
GPRCLEAN \
PRJ_BUILD \
PRJ_TARGET \
PROCESSORS \
SDIR \
TARGET \
TP_XMLADA \
VERSION \
prefix
override GPROPTS += $(foreach v, \
PRJ_BUILD PRJ_TARGET TP_XMLADA PROCESSORS TARGET VERSION \
,"-X$(v)=$($(v))")
GPR_DEFAULT = -XLIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE) \
-XXMLADA_BUILD=$(DEFAULT_LIBRARY_TYPE)
#########
# build #
#########
build: $(LIBRARY_TYPES:%=build-%) build-tools
build-%: tp_xmlada.gpr makefile.setup
$(GPRBUILD) -p $(GPROPTS) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* \
--subdirs=$(SDIR)/$* -Ptemplates_parser
build-tools: build-$(DEFAULT_LIBRARY_TYPE)
$(GPRBUILD) -p $(GPROPTS) $(GPR_DEFAULT) \
--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) -Ptools/tools
run_regtests test: build makefile.setup
$(MAKE) -C regtests test
DOC_FORMATS := html latexpdf
build-doc: tp_xmlada.gpr makefile.setup
$(MAKE) -C docs $(DOC_FORMATS)
echo Templates_Parser Documentation built with success.
#########
# setup #
#########
tp_xmlada.gpr:
ifeq ($(TP_XMLADA), Installed)
cp config/tp_xmlada_installed.gpr tp_xmlada.gpr
else
cp config/tp_xmlada_dummy.gpr tp_xmlada.gpr
endif
force:
makefile.setup: setup
setup: tp_xmlada.gpr force
printf " $(foreach v,$(ALL_OPTIONS),$(v) = $($(v))\n)" > makefile.setup
###########
# install #
###########
uninstall:
ifneq (,$(wildcard $(TPREFIX)/share/gpr/manifests/templates_parser))
-$(GPRINSTALL) $(GPROPTS) -f --uninstall \
--prefix=$(TPREFIX) templates_parser
endif
GPRINST_OPTS=-p -f --prefix=$(TPREFIX) \
--build-var=LIBRARY_TYPE --build-var=TEMPLATES_PARSER_BUILD
install: uninstall $(LIBRARY_TYPES:%=install-%)
$(GPRINSTALL) $(GPROPTS) $(GPR_DEFAULT) $(GPRINST_OPTS) \
--mode=usage --subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) \
--install-name=templates_parser -Ptools/tools
install-%:
$(GPRINSTALL) $(GPROPTS) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$*\
$(GPRINST_OPTS) --subdirs=$(SDIR)/$* --build-name=$* -Ptemplates_parser
#########
# clean #
#########
clean: $(LIBRARY_TYPES:%=clean-%)
-$(GPRCLEAN) $(GPR_DEFAULT) $(GPROPTS) -Ptools/tools
$(MAKE) -C docs clean
$(MAKE) -C regtests clean
rm -f auto.cgpr config/setup/auto.cgpr
rm -fr .build makefile.setup
rm -f config/setup/foo.ali config/setup/foo.o tp_xmlada.gpr
rm -f config/setup/foo.ads.std*
clean-%:
-$(GPRCLEAN) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* $(GPROPTS) \
-Ptemplates_parser
|