-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
115 lines (98 loc) · 4.02 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
############################################################################
# Win32Ada #
# #
# Copyright (C) 2008-2014, AdaCore #
# #
# This library is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or (at #
# your option) any later version. #
# #
# This library 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 #
# along with this library; if not, write to the Free Software Foundation, #
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
# #
# As a special exception, if other files instantiate generics from this #
# unit, or you link this unit with other files to produce an executable, #
# this unit does not by itself cause the resulting executable to be #
# covered by the GNU General Public License. This exception does not #
# however invalidate any other reasons why the executable file might be #
# covered by the GNU Public License. #
############################################################################
.SILENT:
############################################################################
# Default configuration
prefix = $(dir $(shell which gnatls))..
ENABLE_SHARED = true
PROCESSORS = 2
DEBUG = false
TARGET = $(shell gcc -dumpmachine)
-include makefile.setup
MKDIR = mkdir
CP = cp -p
GPRBUILD = gprbuild
GPRCLEAN = gprclean
GPRINSTALL = gprinstall
RM = rm -f
HOST = $(shell gcc -dumpmachine)
GPROPTS = -XPRJ_TARGET=$(PRJ_TARGET) -XTARGET=$(TARGET)
BUILD = .build/$(TARGET)
ifeq ($(HOST), $(TARGET))
TPREFIX=$(prefix)
else
GPROPTS += --target=$(TARGET)
TPREFIX=$(prefix)/$(TARGET)
endif
ifeq ($(strip $(findstring x86_64, $(TARGET))),x86_64)
PRJ_TARGET=Win64
else
ifeq ($(strip $(findstring i686, $(TARGET))),i686)
PRJ_TARGET=Win32
else
@error Unrecognized target
endif
endif
ifeq ($(DEBUG), true)
BDIR = $(BUILD)/debug
GPROPTS += -XPRJ_BUILD=Debug
else
BDIR = $(BUILD)/release
GPROPTS += -XPRJ_BUILD=Release
endif
############################################################################
all: build
setup:
echo "prefix=$(prefix)" > 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-clean:
ifneq (,$(wildcard $(TPREFIX)/share/gpr/manifests/win32ada))
-$(GPRINSTALL) $(GPROPTS) --uninstall --prefix=$(TPREFIX) win32ada
endif
install: install-clean
$(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(TPREFIX) \
-XLIBRARY_TYPE=static -P win32ada
ifeq (${ENABLE_SHARED}, true)
$(GPRINSTALL) $(GPROPTS) -p -f --prefix=$(TPREFIX) \
-XLIBRARY_TYPE=relocatable --build-name=relocatable -P win32ada
endif
build:
$(GPRBUILD) -p $(GPROPTS) -j$(PROCESSORS) \
-XLIBRARY_TYPE=static -P win32ada
ifeq (${ENABLE_SHARED}, true)
$(GPRBUILD) -p $(GPROPTS) -j$(PROCESSORS) \
-XLIBRARY_TYPE=relocatable -P win32ada
endif
clean:
$(GPRCLEAN) $(GPROPTS) -XLIBRARY_TYPE=static -P win32ada
ifeq (${ENABLE_SHARED}, true)
$(GPRCLEAN) $(GPROPTS) -XLIBRARY_TYPE=relocatable -P win32ada
endif
$(RM) -fr $(BUILD) makefile.setup