| 1 |
############################################################################ |
| 2 |
# Ada Web Server # |
| 3 |
# # |
| 4 |
# Copyright (C) 2003-2020, AdaCore # |
| 5 |
# # |
| 6 |
# This is free software; you can redistribute it and/or modify it # |
| 7 |
# under terms of the GNU General Public License as published by the # |
| 8 |
# Free Software Foundation; either version 3, or (at your option) any # |
| 9 |
# later version. This software is distributed in the hope that it will # |
| 10 |
# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # |
| 11 |
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # |
| 12 |
# General Public License for more details. # |
| 13 |
# # |
| 14 |
# You should have received a copy of the GNU General Public License # |
| 15 |
# distributed with this software; see file COPYING3. If not, go # |
| 16 |
# to http://www.gnu.org/licenses for a complete copy of the license. # |
| 17 |
############################################################################ |
| 18 |
|
| 19 |
ifndef VERBOSE_MAKE |
| 20 |
.SILENT: |
| 21 |
endif |
| 22 |
|
| 23 |
VERSION = 22.0 |
| 24 |
|
| 25 |
DEBUG = false |
| 26 |
TP_TASKING = Standard_Tasking |
| 27 |
PROCESSORS = 0 |
| 28 |
HOST := $(shell gcc -dumpmachine) |
| 29 |
TARGET := $(shell gcc -dumpmachine) |
| 30 |
prefix := $(dir $(shell which gnatls)).. |
| 31 |
DEFAULT_LIBRARY_TYPE = static |
| 32 |
|
| 33 |
GNAT := gnat |
| 34 |
|
| 35 |
ENABLE_STATIC = true |
| 36 |
ENABLE_SHARED := $(shell $(GNAT) make -c -q -p -XTARGET=$(TARGET) \ |
| 37 |
-Pconfig/setup/test_shared 2>/dev/null && echo "true") |
| 38 |
|
| 39 |
ifeq ($(shell gnat ls -Pxmlada_dom 2>&1 | grep 'project file .* not found'),) |
| 40 |
TP_XMLADA := Installed |
| 41 |
else |
| 42 |
TP_XMLADA := Disabled |
| 43 |
endif |
| 44 |
|
| 45 |
ifeq ($(HOST), $(TARGET)) |
| 46 |
GPROPTS = |
| 47 |
TPREFIX=$(DESTDIR)$(prefix) |
| 48 |
else |
| 49 |
GPROPTS = --target=$(TARGET) |
| 50 |
TPREFIX=$(DESTDIR)$(prefix)/$(TARGET) |
| 51 |
endif |
| 52 |
|
| 53 |
MODE = $(if $(filter-out true,$(DEBUG)),release,debug) |
| 54 |
SDIR = $(TARGET)/$(MODE) |
| 55 |
|
| 56 |
GPRBUILD = gprbuild |
| 57 |
GPRINSTALL = gprinstall |
| 58 |
GPRCLEAN = gprclean |
| 59 |
|
| 60 |
# Compute the default library kind, and possibly the other that are to |
| 61 |
# be built. |
| 62 |
|
| 63 |
ifeq ($(DEFAULT_LIBRARY_TYPE),shared) |
| 64 |
ifneq ($(ENABLE_SHARED),true) |
| 65 |
$(error shared not enabled, cannot be the default) |
| 66 |
endif |
| 67 |
endif |
| 68 |
|
| 69 |
ifeq ($(DEFAULT_LIBRARY_TYPE),static) |
| 70 |
ifneq ($(ENABLE_STATIC),true) |
| 71 |
$(error static not enabled, cannot be the default) |
| 72 |
endif |
| 73 |
endif |
| 74 |
|
| 75 |
ifeq ($(ENABLE_STATIC), true) |
| 76 |
LIBRARY_TYPES += static |
| 77 |
endif |
| 78 |
|
| 79 |
ifeq ($(ENABLE_SHARED), true) |
| 80 |
LIBRARY_TYPES += relocatable static-pic |
| 81 |
endif |
| 82 |
|
| 83 |
ifeq ($(DEBUG), true) |
| 84 |
PRJ_BUILD := Debug |
| 85 |
else |
| 86 |
PRJ_BUILD := Release |
| 87 |
endif |
| 88 |
|
| 89 |
ifeq ($(strip $(findstring linux, $(TARGET))),linux) |
| 90 |
PRJ_TARGET=Linux |
| 91 |
else |
| 92 |
ifeq ($(strip $(findstring mingw32, $(TARGET))),mingw32) |
| 93 |
PRJ_TARGET=Windows |
| 94 |
else |
| 95 |
ifeq ($(strip $(findstring cygwin, $(TARGET))),cygwin) |
| 96 |
PRJ_TARGET=Windows |
| 97 |
else |
| 98 |
ifeq ($(strip $(findstring darwin, $(TARGET))),darwin) |
| 99 |
PRJ_TARGET=macOS |
| 100 |
else |
| 101 |
ifeq ($(strip $(findstring freebsd, $(TARGET))),freebsd) |
| 102 |
PRJ_TARGET=FreeBSD |
| 103 |
else |
| 104 |
PRJ_TARGET=UNIX |
| 105 |
endif |
| 106 |
endif |
| 107 |
endif |
| 108 |
endif |
| 109 |
endif |
| 110 |
|
| 111 |
-include makefile.setup |
| 112 |
|
| 113 |
ALL_OPTIONS := \ |
| 114 |
DEBUG \ |
| 115 |
DEFAULT_LIBRARY_TYPE \ |
| 116 |
ENABLE_SHARED \ |
| 117 |
ENABLE_STATIC \ |
| 118 |
GNAT \ |
| 119 |
GPRBUILD \ |
| 120 |
GPRCLEAN \ |
| 121 |
PRJ_BUILD \ |
| 122 |
PRJ_TARGET \ |
| 123 |
PROCESSORS \ |
| 124 |
SDIR \ |
| 125 |
TARGET \ |
| 126 |
TP_XMLADA \ |
| 127 |
VERSION \ |
| 128 |
prefix |
| 129 |
|
| 130 |
override GPROPTS += $(foreach v, \ |
| 131 |
PRJ_BUILD PRJ_TARGET TP_XMLADA PROCESSORS TARGET VERSION \ |
| 132 |
,"-X$(v)=$($(v))") |
| 133 |
|
| 134 |
GPR_DEFAULT = -XLIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE) \ |
| 135 |
-XXMLADA_BUILD=$(DEFAULT_LIBRARY_TYPE) |
| 136 |
|
| 137 |
######### |
| 138 |
# build # |
| 139 |
######### |
| 140 |
|
| 141 |
build: $(LIBRARY_TYPES:%=build-%) build-tools |
| 142 |
|
| 143 |
build-%: tp_xmlada.gpr makefile.setup |
| 144 |
$(GPRBUILD) -p $(GPROPTS) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* \ |
| 145 |
--subdirs=$(SDIR)/$* -Ptemplates_parser |
| 146 |
|
| 147 |
build-tools: build-$(DEFAULT_LIBRARY_TYPE) |
| 148 |
$(GPRBUILD) -p $(GPROPTS) $(GPR_DEFAULT) \ |
| 149 |
--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) -Ptools/tools |
| 150 |
|
| 151 |
run_regtests test: build makefile.setup |
| 152 |
$(MAKE) -C regtests test |
| 153 |
|
| 154 |
DOC_FORMATS := html latexpdf |
| 155 |
build-doc: tp_xmlada.gpr makefile.setup |
| 156 |
$(MAKE) -C docs $(DOC_FORMATS) |
| 157 |
echo Templates_Parser Documentation built with success. |
| 158 |
|
| 159 |
######### |
| 160 |
# setup # |
| 161 |
######### |
| 162 |
|
| 163 |
tp_xmlada.gpr: |
| 164 |
ifeq ($(TP_XMLADA), Installed) |
| 165 |
cp config/tp_xmlada_installed.gpr tp_xmlada.gpr |
| 166 |
else |
| 167 |
cp config/tp_xmlada_dummy.gpr tp_xmlada.gpr |
| 168 |
endif |
| 169 |
|
| 170 |
force: |
| 171 |
|
| 172 |
makefile.setup: setup |
| 173 |
|
| 174 |
setup: tp_xmlada.gpr force |
| 175 |
printf " $(foreach v,$(ALL_OPTIONS),$(v) = $($(v))\n)" > makefile.setup |
| 176 |
|
| 177 |
########### |
| 178 |
# install # |
| 179 |
########### |
| 180 |
|
| 181 |
uninstall: |
| 182 |
ifneq (,$(wildcard $(TPREFIX)/share/gpr/manifests/templates_parser)) |
| 183 |
-$(GPRINSTALL) $(GPROPTS) -f --uninstall \ |
| 184 |
--prefix=$(TPREFIX) templates_parser |
| 185 |
endif |
| 186 |
|
| 187 |
GPRINST_OPTS=-p -f --prefix=$(TPREFIX) \ |
| 188 |
--build-var=LIBRARY_TYPE --build-var=TEMPLATES_PARSER_BUILD |
| 189 |
|
| 190 |
install: uninstall $(LIBRARY_TYPES:%=install-%) |
| 191 |
$(GPRINSTALL) $(GPROPTS) $(GPR_DEFAULT) $(GPRINST_OPTS) \ |
| 192 |
--mode=usage --subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) \ |
| 193 |
--install-name=templates_parser -Ptools/tools |
| 194 |
|
| 195 |
install-%: |
| 196 |
$(GPRINSTALL) $(GPROPTS) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$*\ |
| 197 |
$(GPRINST_OPTS) --subdirs=$(SDIR)/$* --build-name=$* -Ptemplates_parser |
| 198 |
|
| 199 |
######### |
| 200 |
# clean # |
| 201 |
######### |
| 202 |
|
| 203 |
clean: $(LIBRARY_TYPES:%=clean-%) |
| 204 |
-$(GPRCLEAN) $(GPR_DEFAULT) $(GPROPTS) -Ptools/tools |
| 205 |
$(MAKE) -C docs clean |
| 206 |
$(MAKE) -C regtests clean |
| 207 |
rm -f auto.cgpr config/setup/auto.cgpr |
| 208 |
rm -fr .build makefile.setup |
| 209 |
rm -f config/setup/foo.ali config/setup/foo.o tp_xmlada.gpr |
| 210 |
rm -f config/setup/foo.ads.std* |
| 211 |
|
| 212 |
clean-%: |
| 213 |
-$(GPRCLEAN) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* $(GPROPTS) \ |
| 214 |
-Ptemplates_parser |