-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmakefile
125 lines (102 loc) · 4.11 KB
/
makefile
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
############################################################################
# wPOSIX #
# #
# Copyright (C) 2008-2016, 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. #
############################################################################
.SILENT:
############################################################################
# Default configuration
VERSION = 18.0w
prefix = $(dir $(shell which gnatls))..
ENABLE_SHARED = true
DEFAULT_LIBRARY_TYPE = static
PROCESSORS = 0
DEBUG = false
TARGET = $(shell gcc -dumpmachine)
-include makefile.setup
OTHER_LIBRARY_TYPE = \
$(if $(filter-out static,$(DEFAULT_LIBRARY_TYPE)),static,relocatable)
HOST = $(shell gcc -dumpmachine)
MODE = $(if $(filter-out true,$(DEBUG)),release,debug)
SDIR = $(TARGET)/$(MODE)
ifeq ($(DEBUG), true)
GPROPTS = -XPRJ_BUILD=Debug
else
GPROPTS = -XPRJ_BUILD=Release
endif
ifeq ($(HOST), $(TARGET))
TPREFIX = $(prefix)
else
GPROPTS += --target=$(TARGET)
TPREFIX = $(prefix)/$(TARGET)
endif
MKDIR = mkdir
CP = cp -p
GPRBUILD = gprbuild
GPRINSTALL = gprinstall
GPRCLEAN = gprclean
RM = rm -f
PYTHON = python
############################################################################
all: build
#######################################################################
# setup
setup: gen_setup
gen_setup:
echo "prefix=$(prefix)" > makefile.setup
echo "DEFAULT_LIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE)" >> makefile.setup
echo "ENABLE_SHARED=$(ENABLE_SHARED)" >> makefile.setup
echo "DEBUG=$(DEBUG)" >> makefile.setup
echo "PROCESSORS=$(PROCESSORS)" >> makefile.setup
echo "TARGET=$(TARGET)" >> makefile.setup
#######################################################################
# install
install-clean:
-$(GPRINSTALL) $(GPROPTS) -q --uninstall --prefix=$(TPREFIX) -Pwposix
# Make sure we install first the default library type as it will be made
# the default by gprinstall, then the other version.
install: install-clean
$(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(TPREFIX) \
--subdirs=$(SDIR)/$(DEFAULT_LIBRARY_TYPE) \
-XLIBRARY_TYPE=$(DEFAULT_LIBRARY_TYPE) -Pwposix
ifeq (${ENABLE_SHARED}, true)
$(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(TPREFIX) \
--subdirs=$(SDIR)/$(OTHER_LIBRARY_TYPE) \
-XLIBRARY_TYPE=$(OTHER_LIBRARY_TYPE) \
-XWIN32ADA_BUILD=$(OTHER_LIBRARY_TYPE) \
--build-name=$(OTHER_LIBRARY_TYPE) -Pwposix
endif
#######################################################################
# build
build:
$(GPRBUILD) -p $(GPROPTS) -j$(PROCESSORS) \
--subdirs=$(SDIR)/static -XLIBRARY_TYPE=static -Pwposix
ifeq (${ENABLE_SHARED}, true)
$(GPRBUILD) -p $(GPROPTS) -j$(PROCESSORS) \
--subdirs=$(SDIR)/relocatable -XLIBRARY_TYPE=relocatable \
-XWIN32ADA_BUILD=relocatable -Pwposix
endif
#######################################################################
# clean
clean:
-$(GPRCLEAN) $(GPROPTS) -XLIBRARY_TYPE=static \
--subdirs=$(SDIR)/static -Pwposix
ifeq (${ENABLE_SHARED}, true)
-$(GPRCLEAN) $(GPROPTS) -XLIBRARY_TYPE=relocatable \
--subdirs=$(SDIR)/relocatable -Pwposix
endif
$(RM) -fr .build makefile.setup
run_regtests:
(cd regtests; $(PYTHON) ./testsuite.py)