Debian Codegraph @

deps/gnatcoll-slim/Makefile

raw symbols SCIP
1 ##############################################################################
2 ## ##
3 ## GNATCOLL LIBRARY ##
4 ## ##
5 ## Copyright (C) 2017, AdaCore. ##
6 ## ##
7 ## This library is free software; you can redistribute it and/or modify it ##
8 ## under terms of the GNU General Public License as published by the Free ##
9 ## Software Foundation; either version 3, or (at your option) any later ##
10 ## version. This library is distributed in the hope that it will be useful, ##
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN# ##
12 ## TABILITY or FITNESS FOR A PARTICULAR PURPOSE. ##
13 ## ##
14 ## As a special exception under Section 7 of GPL version 3, you are granted ##
15 ## additional permissions described in the GCC Runtime Library Exception, ##
16 ## version 3.1, as published by the Free Software Foundation. ##
17 ## ##
18 ## You should have received a copy of the GNU General Public License and ##
19 ## a copy of the GCC Runtime Library Exception along with this program; ##
20 ## see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ##
21 ## <http://www.gnu.org/licenses/>. ##
22 ## ##
23 ##############################################################################
24
25 # Makefile targets
26 # ----------------
27 #
28 # Setup: make [VAR=VALUE] setup (see below)
29 # Build: make
30 # Install: make install
31
32 # Variables which can be set:
33 #
34 # General:
35 #
36 # prefix : root install directory
37 # ENABLE_SHARED : yes / no (or empty)
38 # BUILD : DEBUG PROD
39 # PROCESSORS : nb parallel compilations (0 to use all cores)
40 # TARGET : target triplet for cross-compilation
41 # INTEGRATED : installs the project as part of the compiler installation;
42 # this adds NORMALIZED_TARGET subdir to prefix
43 #
44 # Project specific:
45 #
46 # GNATCOLL_MMAP : whether MMAP is supported (yes/no)
47 # default is "yes"; has no effect on Windows
48 # GNATCOLL_MADVISE : whether MADVISE is supported (yes/no)
49 # default is "yes"; has no effect on Windows
50 # GNATCOLL_ATOMICS : atomic model (intrinsic/mutex)
51 # default is "intrinsic"
52
53 # helper programs
54 CAT := cat
55 ECHO := echo
56 WHICH := which
57
58 # check for out-of-tree build
59 SOURCE_DIR := $(dir $(MAKEFILE_LIST))
60 ifeq ($(SOURCE_DIR),./)
61 RBD=
62 GNATCOLL_GPR=gnatcoll.gpr
63 MAKEPREFIX=
64 else
65 RBD=--relocate-build-tree
66 GNATCOLL_GPR=$(SOURCE_DIR)/gnatcoll.gpr
67 MAKEPREFIX=$(SOURCE_DIR)/
68 endif
69
70 TARGET := $(shell gcc -dumpmachine)
71 NORMALIZED_TARGET := $(subst normalized_target:,,$(wordlist 6,6,$(shell gprconfig --config=ada --target=$(TARGET) --mi-show-compilers)))
72 ifeq ($(NORMALIZED_TARGET),)
73 $(error No toolchain found for target "$(TARGET)")
74 endif
75
76 GNATCOLL_OS := $(if $(findstring darwin,$(NORMALIZED_TARGET)),osx,$(if $(findstring windows,$(NORMALIZED_TARGET)),windows,unix))
77
78 prefix := $(dir $(shell $(WHICH) gnatls))..
79 GNATCOLL_VERSION := $(shell $(CAT) $(SOURCE_DIR)/version_information)
80 GNATCOLL_MMAP := yes
81 GNATCOLL_MADVISE := yes
82 GNATCOLL_ATOMICS := intrinsic
83
84 BUILD = PROD
85 PROCESSORS = 0
86 BUILD_DIR =
87 ENABLE_SHARED = yes
88 INTEGRATED = no
89
90 all: build
91
92 # Load current setup if any
93 -include makefile.setup
94
95 GTARGET=--target=$(NORMALIZED_TARGET)
96
97 ifeq ($(ENABLE_SHARED), yes)
98 LIBRARY_TYPES=static relocatable static-pic
99 else
100 LIBRARY_TYPES=static
101 endif
102
103 ifeq ($(INTEGRATED), yes)
104 integrated_install=/$(NORMALIZED_TARGET)
105 endif
106
107
108 GPR_VARS=-XGNATCOLL_MMAP=$(GNATCOLL_MMAP) \
109 -XGNATCOLL_MADVISE=$(GNATCOLL_MADVISE) \
110 -XGNATCOLL_ATOMICS=$(GNATCOLL_ATOMICS) \
111 -XGNATCOLL_VERSION=$(GNATCOLL_VERSION) \
112 -XGNATCOLL_OS=$(GNATCOLL_OS) \
113 -XBUILD=$(BUILD)
114
115 # Used to pass extra options to GPRBUILD, like -d for instance
116 GPRBUILD_OPTIONS=
117
118 BUILDER=gprbuild -p -m $(GTARGET) $(RBD) -j$(PROCESSORS) $(GPR_VARS) \
119 $(GPRBUILD_OPTIONS)
120 INSTALLER=gprinstall -p -f $(GTARGET) $(GPR_VARS) \
121 $(RBD) --sources-subdir=include/gnatcoll --prefix=$(prefix)$(integrated_install)
122 CLEANER=gprclean -q $(RBD) $(GTARGET)
123 UNINSTALLER=$(INSTALLER) -p -f --install-name=gnatcoll --uninstall
124
125 #########
126 # build #
127 #########
128
129 build: $(LIBRARY_TYPES:%=build-%)
130
131 build-%:
132 $(BUILDER) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* -XGPR_BUILD=$* \
133 $(GPR_VARS) $(GNATCOLL_GPR)
134
135 ###########
136 # Install #
137 ###########
138
139 uninstall:
140 ifneq (,$(wildcard $(prefix)$(integrated_install)/share/gpr/manifests/gnatcoll))
141 $(UNINSTALLER) $(GNATCOLL_GPR)
142 endif
143
144 install: uninstall $(LIBRARY_TYPES:%=install-%)
145
146 install-%:
147 $(INSTALLER) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* -XGPR_BUILD=$* \
148 --build-name=$* $(GPR_VARS) \
149 --build-var=LIBRARY_TYPE --build-var=GNATCOLL_BUILD \
150 --build-var=GNATCOLL_CORE_BUILD $(GNATCOLL_GPR)
151
152 ###########
153 # Cleanup #
154 ###########
155
156 clean: $(LIBRARY_TYPES:%=clean-%)
157
158 clean-%:
159 -$(CLEANER) -XLIBRARY_TYPE=$* -XXMLADA_BUILD=$* -XGPR_BUILD=$* \
160 $(GPR_VARS) $(GNATCOLL_GPR)
161
162 #########
163 # setup #
164 #########
165
166 .SILENT: setup
167
168 setup:
169 $(ECHO) "prefix=$(prefix)" > makefile.setup
170 $(ECHO) "ENABLE_SHARED=$(ENABLE_SHARED)" >> makefile.setup
171 $(ECHO) "INTEGRATED=$(INTEGRATED)" >> makefile.setup
172 $(ECHO) "BUILD=$(BUILD)" >> makefile.setup
173 $(ECHO) "PROCESSORS=$(PROCESSORS)" >> makefile.setup
174 $(ECHO) "TARGET=$(TARGET)" >> makefile.setup
175 $(ECHO) "SOURCE_DIR=$(SOURCE_DIR)" >> makefile.setup
176 $(ECHO) "GNATCOLL_OS=$(GNATCOLL_OS)" >> makefile.setup
177 $(ECHO) "GNATCOLL_VERSION=$(GNATCOLL_VERSION)" >> makefile.setup
178 $(ECHO) "GNATCOLL_MMAP=$(GNATCOLL_MMAP)" >> makefile.setup
179 $(ECHO) "GNATCOLL_MADVISE=$(GNATCOLL_MADVISE)" >> makefile.setup
180 $(ECHO) "GNATCOLL_ATOMICS=$(GNATCOLL_ATOMICS)" >> makefile.setup