ncurses 5.9 - patch 20140524
[ncurses.git] / Ada95 / src / Makefile.in
1 ##############################################################################
2 # Copyright (c) 1998-2011,2014 Free Software Foundation, Inc.                #
3 #                                                                            #
4 # Permission is hereby granted, free of charge, to any person obtaining a    #
5 # copy of this software and associated documentation files (the "Software"), #
6 # to deal in the Software without restriction, including without limitation  #
7 # the rights to use, copy, modify, merge, publish, distribute, distribute    #
8 # with modifications, sublicense, and/or sell copies of the Software, and to #
9 # permit persons to whom the Software is furnished to do so, subject to the  #
10 # following conditions:                                                      #
11 #                                                                            #
12 # The above copyright notice and this permission notice shall be included in #
13 # all copies or substantial portions of the Software.                        #
14 #                                                                            #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
18 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
20 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
21 # DEALINGS IN THE SOFTWARE.                                                  #
22 #                                                                            #
23 # Except as contained in this notice, the name(s) of the above copyright     #
24 # holders shall not be used in advertising or otherwise to promote the sale, #
25 # use or other dealings in this Software without prior written               #
26 # authorization.                                                             #
27 ##############################################################################
28 #
29 #  Author:  Juergen Pfeifer, 1996
30 #
31 #  $Id: Makefile.in,v 1.68 2014/05/24 21:29:11 tom Exp $
32 #
33 .SUFFIXES:
34
35 SHELL           = /bin/sh
36 VPATH           = @srcdir@
37 THIS            = Makefile
38
39 MODEL           = ../../@DFT_OBJ_SUBDIR@
40
41 DESTDIR         = @DESTDIR@
42
43 top_srcdir      = @top_srcdir@
44 srcdir          = @srcdir@
45 prefix          = @prefix@
46 exec_prefix     = @exec_prefix@
47 includedir      = @includedir@
48 libdir          = @libdir@
49
50 LIBDIR          = $(DESTDIR)$(libdir)
51 ADA_INCLUDE     = $(DESTDIR)@ADA_INCLUDE@
52 ADA_OBJECTS     = $(DESTDIR)@ADA_OBJECTS@
53
54 INSTALL         = @INSTALL@
55 INSTALL_LIB     = @INSTALL@ @INSTALL_LIB@
56
57 AR              = @AR@
58 ARFLAGS         = @ARFLAGS@
59 AWK             = @AWK@
60 LN_S            = @LN_S@
61
62 CC              = @CC@
63 CFLAGS          = @CFLAGS@
64
65 CPPFLAGS        = @ACPPFLAGS@ @CPPFLAGS@ \
66                   -DHAVE_CONFIG_H -I$(srcdir)
67
68 CCFLAGS         = $(CPPFLAGS) $(CFLAGS)
69
70 CFLAGS_NORMAL   = $(CCFLAGS)
71 CFLAGS_DEBUG    = $(CCFLAGS) @CC_G_OPT@ -DTRACE
72 CFLAGS_PROFILE  = $(CCFLAGS) -pg
73 CFLAGS_SHARED   = $(CCFLAGS) @CC_SHARED_OPTS@
74
75 CFLAGS_DEFAULT  = $(CFLAGS_@DFT_UPR_MODEL@)
76
77 LINK            = $(CC)
78 LDFLAGS         = @LDFLAGS@ @LD_MODEL@ @LIBS@
79
80 RANLIB          = @RANLIB@
81
82 ################################################################################
83 ADA             = @cf_ada_compiler@
84 ADAPREP         = gnatprep
85 ADAFLAGS        = @ADAFLAGS@ -I. -I$(srcdir)
86
87 LIB_NAME        = AdaCurses
88 SONAME          = @ADA_SHAREDLIB@
89
90 GNAT_PROJECT    = $(srcdir)/library.gpr
91
92 # build/source are the Ada95 tree
93 BUILD_DIR       = ..
94 SOURCE_DIR      = ..
95
96 BUILD_DIR_LIB   = $(BUILD_DIR)/lib
97 SOURCE_DIR_SRC  = $(SOURCE_DIR)/src
98
99 ADAMAKE         = @cf_ada_make@
100
101 STATIC_LIBNAME  = lib$(LIB_NAME).a
102 SHARED_LIBNAME  = $(SONAME)
103 SHARED_SYMLINK  = lib$(LIB_NAME).so
104
105 ALIB            = @cf_ada_package@
106 ABASE           = $(ALIB)-curses
107 ################################################################################
108 GENERATED_SOURCES=$(ABASE).ads                          \
109                   $(ABASE).adb                          \
110                   $(ABASE)-aux.ads                      \
111                   $(ABASE)-trace.ads                    \
112                   $(ABASE)-menus.ads                    \
113                   $(ABASE)-forms.ads                    \
114                   $(ABASE)-mouse.ads                    \
115                   $(ABASE)-panels.ads                   \
116                   $(ABASE)-menus-menu_user_data.ads     \
117                   $(ABASE)-menus-item_user_data.ads     \
118                   $(ABASE)-forms-form_user_data.ads     \
119                   $(ABASE)-forms-field_types.ads        \
120                   $(ABASE)-forms-field_user_data.ads    \
121                   $(ABASE)-panels-user_data.ads
122 ################################################################################
123 LIBOBJS=$(ALIB).o                                       \
124         $(ABASE)-aux.o                                  \
125         $(ABASE).o                                      \
126         $(ABASE)-terminfo.o                             \
127         $(ABASE)-termcap.o                              \
128         $(ABASE)-putwin.o                               \
129         $(ABASE)-trace.o                                \
130         $(ABASE)-mouse.o                                \
131         $(ABASE)-panels.o                               \
132         $(ABASE)-menus.o                                \
133         $(ABASE)-forms.o                                \
134         $(ABASE)-forms-field_types.o                    \
135         $(ABASE)-forms-field_types-alpha.o              \
136         $(ABASE)-forms-field_types-alphanumeric.o       \
137         $(ABASE)-forms-field_types-intfield.o           \
138         $(ABASE)-forms-field_types-numeric.o            \
139         $(ABASE)-forms-field_types-regexp.o             \
140         $(ABASE)-forms-field_types-enumeration.o        \
141         $(ABASE)-forms-field_types-ipv4_address.o       \
142         $(ABASE)-forms-field_types-user.o               \
143         $(ABASE)-forms-field_types-user-choice.o        \
144         $(ABASE)-text_io.o                              \
145         $(ABASE)-text_io-aux.o
146
147 # Ada object files for generic packages. Since gnat 3.10 they are
148 # also compiled
149 GENOBJS=$(ABASE)-menus-menu_user_data.o                 \
150         $(ABASE)-menus-item_user_data.o                 \
151         $(ABASE)-forms-form_user_data.o                 \
152         $(ABASE)-forms-field_user_data.o                \
153         $(ABASE)-forms-field_types-enumeration-ada.o    \
154         $(ABASE)-panels-user_data.o                     \
155         $(ABASE)-text_io-integer_io.o                   \
156         $(ABASE)-text_io-float_io.o                     \
157         $(ABASE)-text_io-fixed_io.o                     \
158         $(ABASE)-text_io-decimal_io.o                   \
159         $(ABASE)-text_io-enumeration_io.o               \
160         $(ABASE)-text_io-modular_io.o                   \
161         $(ABASE)-text_io-complex_io.o
162
163 all ::  $(BUILD_DIR_LIB)/$(STATIC_LIBNAME)
164         @echo done
165
166 $(ADA_INCLUDE) \
167 $(ADA_OBJECTS) \
168 $(LIBDIR) \
169 $(BUILD_DIR_LIB) :
170         mkdir -p $@
171
172 sources :
173         @echo made $@
174
175 libs \
176 install \
177 install.libs :: \
178                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME)
179         @echo made $(STATIC_LIBNAME)
180
181 install \
182 install.libs :: \
183                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) \
184                 $(ADA_OBJECTS)
185         @$(INSTALL_LIB) \
186                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) \
187                 $(ADA_OBJECTS)
188
189 uninstall \
190 uninstall.libs ::
191         @rm -f $(ADA_OBJECTS)/$(STATIC_LIBNAME)
192
193 mostlyclean ::
194         rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a
195
196 clean :: mostlyclean
197         rm -f $(ABASE)-trace.adb
198
199 distclean :: clean
200         rm -f Makefile
201
202 realclean :: distclean
203
204 BASEDEPS=$(ABASE).ads $(ABASE)-aux.ads $(ABASE).adb
205
206 $(ABASE)-trace.adb : $(srcdir)/$(ABASE)-trace.adb_p
207         rm -f $@
208         $(ADAPREP) -DADA_TRACE=@ADA_TRACE@ $(srcdir)/$(ABASE)-trace.adb_p $@
209
210 ###############################################################################
211 # Use these definitions when building a shared library.
212 SHARED_C_OBJS   = c_varargs_to_ada.o c_threaded_variables.o ncurses_compat.o
213 SHARED_OBJS     = $(SHARED_C_OBJS) $(LIBOBJS) @cf_generic_objects@
214
215 c_varargs_to_ada.o :    $(srcdir)/c_varargs_to_ada.c
216         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_varargs_to_ada.c
217
218 c_threaded_variables.o : $(srcdir)/c_threaded_variables.c
219         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_threaded_variables.c
220
221 ncurses_compat.o :      $(srcdir)/ncurses_compat.c
222         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/ncurses_compat.c
223
224 ###############################################################################
225 # Use these definitions when building a static library.
226 STATIC_C_OBJS   = static_c_varargs_to_ada.o static_c_threaded_variables.o static_ncurses_compat.o
227 STATIC_OBJS     = $(STATIC_C_OBJS) $(LIBOBJS) @cf_generic_objects@
228
229 static_c_varargs_to_ada.o :     $(srcdir)/c_varargs_to_ada.c
230         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_varargs_to_ada.c
231
232 static_c_threaded_variables.o : $(srcdir)/c_threaded_variables.c
233         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_threaded_variables.c
234
235 static_ncurses_compat.o :       $(srcdir)/ncurses_compat.c
236         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/ncurses_compat.c
237
238 ###############################################################################
239
240 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
241                 $(BUILD_DIR_LIB) \
242                 $(STATIC_OBJS)
243         $(AR) $(ARFLAGS) $@ $(STATIC_OBJS)
244
245 $(BUILD_DIR)/dynamic-ali : ; mkdir -p $@
246 $(BUILD_DIR)/dynamic-obj : ; mkdir -p $@
247
248 SHARED_DIRS = \
249         $(BUILD_DIR_LIB) \
250         $(BUILD_DIR)/dynamic-ali \
251         $(BUILD_DIR)/dynamic-obj
252
253 GPR_EMPTY :=
254 GPR_SPACE := $(GPR_EMPTY) $(GPR_EMPTY)
255 GPR_COMMA := ,
256 GPR_LIST = ("$(subst $(GPR_SPACE),"$(GPR_COMMA) ",$(strip $(1)))")
257 $(GNAT_PROJECT) : $(GNAT_PROJECT).sed
258         sed \
259         -e "s|External (\"BUILD_DIR\")|\"`cd $(BUILD_DIR);pwd`\"|" \
260         -e 's/External ("LIB_NAME")/"$(LIB_NAME)"/' \
261         -e 's/External ("SONAME")/"$(SONAME)"/' \
262         -e 's/External_As_List\ ("ADAFLAGS", " ")/$(call GPR_LIST,$(ADAFLAGS))/' \
263         -e 's/External_As_List\ ("LDFLAGS", " ")/$(call GPR_LIST,$(LDFLAGS))/' \
264         $< > $@
265 clean ::
266         rm -rf $(GNAT_PROJECT)
267
268 @MAKE_ADA_SHAREDLIB@all :: $(BUILD_DIR_LIB)/$(SHARED_LIBNAME)
269 @MAKE_ADA_SHAREDLIB@$(BUILD_DIR_LIB)/$(SHARED_LIBNAME) :: \
270 @MAKE_ADA_SHAREDLIB@            $(GNAT_PROJECT) \
271 @MAKE_ADA_SHAREDLIB@            $(ABASE)-trace.adb \
272 @MAKE_ADA_SHAREDLIB@            $(SHARED_DIRS) \
273 @MAKE_ADA_SHAREDLIB@            $(SHARED_OBJS)
274 @MAKE_ADA_SHAREDLIB@    cp $(SHARED_OBJS) $(BUILD_DIR)/dynamic-obj/
275 @MAKE_ADA_SHAREDLIB@    $(ADAMAKE) -P$(GNAT_PROJECT)
276
277 install \
278 install.libs :: $(ADA_INCLUDE)
279         $(INSTALL_LIB) \
280                 $(SOURCE_DIR_SRC)/*.ad[sb] \
281                 $(ADA_INCLUDE)
282
283 install \
284 install.libs :: $(ADA_INCLUDE)
285         $(INSTALL_LIB) \
286                 $(GENERATED_SOURCES) \
287                 $(ADA_INCLUDE)
288
289 uninstall \
290 uninstall.libs ::
291         $(SHELL) -c 'for name in $(SOURCE_DIR_SRC)/*.ad[sb] $(GENERATED_SOURCES); do rm -f $(ADA_INCLUDE)/`basename $$name`; done'
292
293 @MAKE_ADA_SHAREDLIB@install \
294 @MAKE_ADA_SHAREDLIB@install.libs :: $(ADA_OBJECTS) $(LIBDIR)
295 @MAKE_ADA_SHAREDLIB@    $(INSTALL_LIB) \
296 @MAKE_ADA_SHAREDLIB@            $(BUILD_DIR)/dynamic-ali/* \
297 @MAKE_ADA_SHAREDLIB@            $(ADA_OBJECTS)
298 @MAKE_ADA_SHAREDLIB@    $(INSTALL_LIB) \
299 @MAKE_ADA_SHAREDLIB@            $(BUILD_DIR_LIB)/$(SHARED_LIBNAME) \
300 @MAKE_ADA_SHAREDLIB@            $(LIBDIR)
301 @MAKE_ADA_SHAREDLIB@    cd $(LIBDIR) && $(LN_S) $(SHARED_LIBNAME) $(SHARED_SYMLINK)
302 @MAKE_ADA_SHAREDLIB@
303 @MAKE_ADA_SHAREDLIB@uninstall \
304 @MAKE_ADA_SHAREDLIB@uninstall.libs ::
305 @MAKE_ADA_SHAREDLIB@    $(SHELL) -c 'for name in $(BUILD_DIR)/dynamic-ali/* ; do rm -f $(ADA_OBJECTS)/`basename $$name`; done'
306 @MAKE_ADA_SHAREDLIB@
307 @MAKE_ADA_SHAREDLIB@uninstall \
308 @MAKE_ADA_SHAREDLIB@uninstall.libs ::
309 @MAKE_ADA_SHAREDLIB@    rm -f $(LIBDIR)/$(SHARED_SYMLINK)
310 @MAKE_ADA_SHAREDLIB@    rm -f $(LIBDIR)/$(SHARED_LIBNAME)
311
312 clean ::
313         rm -rf $(BUILD_DIR)/dynamic-ali
314         rm -rf $(BUILD_DIR)/dynamic-obj
315         rm -rf $(BUILD_DIR_LIB)