-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.in
197 lines (168 loc) · 5.6 KB
/
Makefile.in
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
# This builds the "Florist" implementation of POSIX.5b
#
# If you need to modify the "configure" file, you will need
# autoconf version 2.12, or maybe a later version will also work.
#
.POSIX:
VERSION=7.3.0w
FLORIST_VERSION=$(VERSION)
GNATPREPFLAGS = -c -r
GCCFLAGS = -O2
TARGET=@host_alias@
ifneq ($(TARGET),)
TARGET_OPTION=--target=$(TARGET)
TARGET_PREFIX=$(TARGET)-
endif
ifeq ($(TARGET),powerpc-elinos-linux)
TARGET_RUNNER=run-cross --target=ppc-elinos,5.1,qemu
endif
# How to invoke ranlib.
RANLIB = ranlib
# configure substitutions
CC = @CC@
LIBS = @LIBS@
DEPS = @DEPS@
SIGNALS_GENERATED = @SIGNALS_GENERATED@
PREFIX = @prefix@
ENABLE_SHARED = @ENABLE_SHARED@
PROJECT_FLAGS = @BUILD_TYPE_OPTION@ @THREADS_OPTION@ @RTS_OPTION@ \
$(TARGET_OPTION)
# Scenario variables and RTS selection must be passed consistently to
# project-aware tools gprbuild, gprinstall, and gprclean.
GNATPREP = $(TARGET_PREFIX)gnatprep
GPRBUILD = gprbuild
GPRBUILD_FLAGS = $(GCCFLAGS) $(PROJECT_FLAGS)
GENDIR = gensrc
GENDIR_ON_TARGET=$(GENDIR)
# files generated by "configure" script
CONFIG_GENERATED = \
confsrc/config.h\
confsrc/pconfig.h\
gnatprep.config\
pconfig.h.in
CONFIG_HISTORY = \
config.cache\
config.log\
c-posix.log\
configure.log\
config.status\
stamp-h
# files generated by "c-posix" program
C-POSIX_GENERATED = \
$(GENDIR)/posix.ads\
$(GENDIR)/posix-limits.ads\
$(GENDIR)/posix-options.ads\
$(GENDIR)/posix-c.ads
# files generated by "c-posix-signals" program (if present)
ifneq "$(strip $(SIGNALS_GENERATED))" ""
C-POSIX-SIGNALS_GENERATED = $(GENDIR)/$(SIGNALS_GENERATED)
else
C-POSIX-SIGNALS_GENERATED =
endif
GNATPREP_SOURCES = $(GENDIR)/posix-implementation.adb $(GENDIR)/threads/posix-timers-extensions.adb
GENERATED = $(C-POSIX_GENERATED) $(C-POSIX-SIGNALS_GENERATED) $(GNATPREP_SOURCES)
# all the executable programs
EXECUTABLES = c-posix c-posix-signals
# default target, get the gnat version and the system type and then
# set up files and call make again (in uname)
all: floristlib
#
# ------------------------------------
# configure-script
# ------------------------------------
#
# This first step should not need to be done during
# normal installation
#
configure: configure.in aclocal.m4
autoconf
#
# ------------------------------------
# generation of OS dependent sources
# ------------------------------------
#
# Program c-posix generates some Ada package specs.
# It is supposed to be a "portable" POSIX C program.
# If it does not compile or does not link,
# it might be fixable by hand-editing config.h or pconfig.h.
# If you are unlucky, it will require fixes to c-posix.c.
#
c-posix: c-posix.c confsrc/config.h confsrc/pconfig.h
$(CC) $(GCCFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix c-posix.c $(LIBS)
#
# Program c-posix-signals generates another Ada package spec.
#
c-posix-signals: c-posix-signals.c
$(CC) $(GCCFLAGS) -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix-signals c-posix-signals.c $(LIBS)
#
# generate Ada source files using "c-posix" program
#
$(C-POSIX_GENERATED): c-posix
mkdir -p $(GENDIR) && cd $(GENDIR) && rm -f posix.ads posix-limits.ads posix-options.ads posix-c.ads
# See file "c-posix.log" for results of this step.
$(TARGET_RUNNER) ./c-posix > c-posix.log 2>&1
#
# generate Ada source files using "c-posix-signals" program
#
$(C-POSIX-SIGNALS_GENERATED): c-posix-signals
mkdir -p $(GENDIR) && cd $(GENDIR) && rm -f posix-implementations-ok_signals.ads
# See file "c-posix-signals.log" for results of this step.
$(TARGET_RUNNER) ./c-posix-signals -nodefaults > c-posix-signals.log 2>&1
#
# Some other Ada source files are tailored to the
# particular OS using the "gnatprep" program.
# The sources for these end in ".gpb" and ".gps".
#
.SUFFIXES: .gps .gpb .ads .adb .o .c
$(GENDIR)/%.ads: libsrc/%.gps gnatprep.config
mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS)
$(GENDIR)/%.adb: libsrc/%.gpb gnatprep.config
mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS)
.c.o:
$(CC) -c $(GCCFLAGS) $<
#
# ------------------------------------
# compilation of Florist packages
# ------------------------------------
#
force:
# build both static and shared library when shared is enabled
ifeq ($(ENABLE_SHARED), yes)
floristlib: $(GENERATED) floristlib-static floristlib-relocatable
install: install-static install-relocatable
# ensure that the relocatable version is build first so the static library
# will use the objects that are already built.
floristlib-static: floristlib-relocatable
# ensure that we don't have two instances of gprinstall trying to install at
# the same time.
install-relocatable: install-static
else
floristlib: $(GENERATED) floristlib-static
install: install-static
endif
floristlib-%: force
$(GPRBUILD) -p $(GPRBUILD_FLAGS) -XLIBRARY_TYPE=$* -Pflorist
# -----------------------------------
# Maintenance targets
# -----------------------------------
#
# remove all c-posix and gnatprep generated files
regen:
rm -f $(GENERATED)
# remove editor and compiler generated files
clean: regen
gprclean -Pflorist $(PROJECT_FLAGS)
rm -rf obj lib
rm -f *# *~ $(EXECUTABLES) b__* b~*
# remove all generated files, including configuration history
distclean: clean
rm -f $(CONFIG_HISTORY) $(CONF_GENERATED)
# install floristlib
# make all files read-only to prevent recompilation
install-%:
gprinstall -Pflorist $(PROJECT_FLAGS) -XLIBRARY_TYPE=$* -a -p -f \
--prefix=$(PREFIX) --sources-subdir=floristlib \
--lib-subdir=floristlib --link-lib-subdir=floristlib \
--build-name=$*
chmod a-w $(PREFIX)/floristlib/*
.PHONY: all install clean distclean regen floristlib force