9726d43e0c5d194be9db6a34ba7f183ca1eca79f
[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.70 2014/08/02 20:31:47 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 ADAMAKEFLAGS    = \
101         -P$(GNAT_PROJECT) \
102         -XBUILD_DIR=`cd $(BUILD_DIR);pwd` \
103         -XSOURCE_DIR=`cd $(SOURCE_DIR);pwd` \
104         -XSOURCE_DIR2=`cd $(srcdir);pwd` \
105         -XLIB_NAME=$(LIB_NAME) \
106         -XSONAME=$(SONAME)
107
108 CARGS           = -cargs $(ADAFLAGS)
109 LARGS           =
110
111 STATIC_LIBNAME  = lib$(LIB_NAME).a
112 SHARED_LIBNAME  = $(SONAME)
113 SHARED_SYMLINK  = lib$(LIB_NAME).so
114
115 ALIB            = @cf_ada_package@
116 ABASE           = $(ALIB)-curses
117 ################################################################################
118 GENERATED_SOURCES=$(ABASE).ads                          \
119                   $(ABASE).adb                          \
120                   $(ABASE)-aux.ads                      \
121                   $(ABASE)-trace.ads                    \
122                   $(ABASE)-menus.ads                    \
123                   $(ABASE)-forms.ads                    \
124                   $(ABASE)-mouse.ads                    \
125                   $(ABASE)-panels.ads                   \
126                   $(ABASE)-menus-menu_user_data.ads     \
127                   $(ABASE)-menus-item_user_data.ads     \
128                   $(ABASE)-forms-form_user_data.ads     \
129                   $(ABASE)-forms-field_types.ads        \
130                   $(ABASE)-forms-field_user_data.ads    \
131                   $(ABASE)-panels-user_data.ads
132 ################################################################################
133 LIBOBJS=$(ALIB).o                                       \
134         $(ABASE)-aux.o                                  \
135         $(ABASE).o                                      \
136         $(ABASE)-terminfo.o                             \
137         $(ABASE)-termcap.o                              \
138         $(ABASE)-putwin.o                               \
139         $(ABASE)-trace.o                                \
140         $(ABASE)-mouse.o                                \
141         $(ABASE)-panels.o                               \
142         $(ABASE)-menus.o                                \
143         $(ABASE)-forms.o                                \
144         $(ABASE)-forms-field_types.o                    \
145         $(ABASE)-forms-field_types-alpha.o              \
146         $(ABASE)-forms-field_types-alphanumeric.o       \
147         $(ABASE)-forms-field_types-intfield.o           \
148         $(ABASE)-forms-field_types-numeric.o            \
149         $(ABASE)-forms-field_types-regexp.o             \
150         $(ABASE)-forms-field_types-enumeration.o        \
151         $(ABASE)-forms-field_types-ipv4_address.o       \
152         $(ABASE)-forms-field_types-user.o               \
153         $(ABASE)-forms-field_types-user-choice.o        \
154         $(ABASE)-text_io.o                              \
155         $(ABASE)-text_io-aux.o
156
157 # Ada object files for generic packages. Since gnat 3.10 they are
158 # also compiled
159 GENOBJS=$(ABASE)-menus-menu_user_data.o                 \
160         $(ABASE)-menus-item_user_data.o                 \
161         $(ABASE)-forms-form_user_data.o                 \
162         $(ABASE)-forms-field_user_data.o                \
163         $(ABASE)-forms-field_types-enumeration-ada.o    \
164         $(ABASE)-panels-user_data.o                     \
165         $(ABASE)-text_io-integer_io.o                   \
166         $(ABASE)-text_io-float_io.o                     \
167         $(ABASE)-text_io-fixed_io.o                     \
168         $(ABASE)-text_io-decimal_io.o                   \
169         $(ABASE)-text_io-enumeration_io.o               \
170         $(ABASE)-text_io-modular_io.o                   \
171         $(ABASE)-text_io-complex_io.o
172
173 all ::  $(BUILD_DIR_LIB)/$(STATIC_LIBNAME)
174         @echo done
175
176 $(ADA_INCLUDE) \
177 $(ADA_OBJECTS) \
178 $(LIBDIR) \
179 $(BUILD_DIR_LIB) :
180         mkdir -p $@
181
182 sources :
183         @echo made $@
184
185 libs \
186 install \
187 install.libs :: \
188                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME)
189         @echo made $(STATIC_LIBNAME)
190
191 install \
192 install.libs :: \
193                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) \
194                 $(ADA_OBJECTS)
195         @$(INSTALL_LIB) \
196                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) \
197                 $(ADA_OBJECTS)
198
199 uninstall \
200 uninstall.libs ::
201         @rm -f $(ADA_OBJECTS)/$(STATIC_LIBNAME)
202
203 mostlyclean ::
204         rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a
205
206 clean :: mostlyclean
207         rm -f $(ABASE)-trace.adb
208
209 distclean :: clean
210         rm -f Makefile
211
212 realclean :: distclean
213
214 BASEDEPS=$(ABASE).ads $(ABASE)-aux.ads $(ABASE).adb
215
216 $(ABASE)-trace.adb : $(srcdir)/$(ABASE)-trace.adb_p
217         rm -f $@
218         $(ADAPREP) -DADA_TRACE=@ADA_TRACE@ @GNATPREP_OPTS@ $(srcdir)/$(ABASE)-trace.adb_p $@
219
220 ###############################################################################
221 # Use these definitions when building a shared library.
222 SHARED_C_OBJS   = c_varargs_to_ada.o c_threaded_variables.o ncurses_compat.o
223 SHARED_OBJS     = $(SHARED_C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
224
225 c_varargs_to_ada.o :    $(srcdir)/c_varargs_to_ada.c
226         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_varargs_to_ada.c
227
228 c_threaded_variables.o : $(srcdir)/c_threaded_variables.c
229         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_threaded_variables.c
230
231 ncurses_compat.o :      $(srcdir)/ncurses_compat.c
232         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/ncurses_compat.c
233
234 ###############################################################################
235 # Use these definitions when building a static library.
236 STATIC_C_OBJS   = static_c_varargs_to_ada.o static_c_threaded_variables.o static_ncurses_compat.o
237 STATIC_OBJS     = $(STATIC_C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
238
239 static_c_varargs_to_ada.o :     $(srcdir)/c_varargs_to_ada.c
240         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_varargs_to_ada.c
241
242 static_c_threaded_variables.o : $(srcdir)/c_threaded_variables.c
243         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_threaded_variables.c
244
245 static_ncurses_compat.o :       $(srcdir)/ncurses_compat.c
246         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/ncurses_compat.c
247
248 ###############################################################################
249
250 @USE_OLD_MAKERULES@$(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
251 @USE_OLD_MAKERULES@             $(BUILD_DIR_LIB) \
252 @USE_OLD_MAKERULES@             $(STATIC_OBJS)
253 @USE_OLD_MAKERULES@     $(AR) $(ARFLAGS) $@ $(STATIC_OBJS)
254
255 $(BUILD_DIR)/static-ali : ; mkdir -p $@
256 $(BUILD_DIR)/static-obj : ; mkdir -p $@
257
258 STATIC_DIRS = \
259         $(BUILD_DIR_LIB) \
260         $(BUILD_DIR)/static-ali \
261         $(BUILD_DIR)/static-obj
262
263 @USE_GNAT_PROJECTS@$(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
264 @USE_GNAT_PROJECTS@             $(ABASE)-trace.adb \
265 @USE_GNAT_PROJECTS@             $(STATIC_C_OBJS) \
266 @USE_GNAT_PROJECTS@             $(STATIC_DIRS)
267 @USE_GNAT_PROJECTS@     $(ADAMAKE) $(ADAMAKEFLAGS) -XLIB_KIND=static
268 @USE_GNAT_PROJECTS@     $(AR) $(ARFLAGS) $@ $(STATIC_C_OBJS)
269 @USE_GNAT_PROJECTS@
270 @USE_GNAT_LIBRARIES@install \
271 @USE_GNAT_LIBRARIES@install.libs :: \
272 @USE_GNAT_LIBRARIES@            $(ADA_OBJECTS)
273 @USE_GNAT_LIBRARIES@    $(INSTALL_LIB) \
274 @USE_GNAT_LIBRARIES@            $(BUILD_DIR)/static-ali/*.ali \
275 @USE_GNAT_LIBRARIES@            $(ADA_OBJECTS)
276
277 uninstall \
278 uninstall.libs ::
279         @rm -f $(ADA_OBJECTS)/$(STATIC_LIBNAME)
280
281 @USE_GNAT_LIBRARIES@uninstall \
282 @USE_GNAT_LIBRARIES@uninstall.libs ::
283 @USE_GNAT_LIBRARIES@    @$(SHELL) -c 'for name in $(BUILD_DIR)/static-ali/*.ali ; do rm -f $(ADA_OBJECTS)/`basename $$name`; done'
284
285 $(BUILD_DIR)/dynamic-ali : ; mkdir -p $@
286 $(BUILD_DIR)/dynamic-obj : ; mkdir -p $@
287
288 SHARED_DIRS = \
289         $(BUILD_DIR_LIB) \
290         $(BUILD_DIR)/dynamic-ali \
291         $(BUILD_DIR)/dynamic-obj
292
293 @MAKE_ADA_SHAREDLIB@all :: $(BUILD_DIR_LIB)/$(SHARED_LIBNAME)
294 @MAKE_ADA_SHAREDLIB@$(BUILD_DIR_LIB)/$(SHARED_LIBNAME) :: \
295 @MAKE_ADA_SHAREDLIB@            $(ABASE)-trace.adb \
296 @MAKE_ADA_SHAREDLIB@            $(SHARED_DIRS) \
297 @MAKE_ADA_SHAREDLIB@            $(SHARED_OBJS)
298 @MAKE_ADA_SHAREDLIB@    cp $(SHARED_OBJS) $(BUILD_DIR)/dynamic-obj/
299 @MAKE_ADA_SHAREDLIB@    $(ADAMAKE) $(ADAMAKEFLAGS) -XLIB_KIND=dynamic
300
301 install \
302 install.libs :: $(ADA_INCLUDE)
303         $(INSTALL_LIB) \
304                 $(SOURCE_DIR_SRC)/*.ad[sb] \
305                 $(ADA_INCLUDE)
306
307 install \
308 install.libs :: $(ADA_INCLUDE)
309         $(INSTALL_LIB) \
310                 $(GENERATED_SOURCES) \
311                 $(ADA_INCLUDE)
312
313 uninstall \
314 uninstall.libs ::
315         $(SHELL) -c 'for name in $(SOURCE_DIR_SRC)/*.ad[sb] $(GENERATED_SOURCES); do rm -f $(ADA_INCLUDE)/`basename $$name`; done'
316
317 @MAKE_ADA_SHAREDLIB@install \
318 @MAKE_ADA_SHAREDLIB@install.libs :: $(ADA_OBJECTS) $(LIBDIR)
319 @MAKE_ADA_SHAREDLIB@    $(INSTALL_LIB) \
320 @MAKE_ADA_SHAREDLIB@            $(BUILD_DIR)/dynamic-ali/* \
321 @MAKE_ADA_SHAREDLIB@            $(ADA_OBJECTS)
322 @MAKE_ADA_SHAREDLIB@    $(INSTALL_LIB) \
323 @MAKE_ADA_SHAREDLIB@            $(BUILD_DIR_LIB)/$(SHARED_LIBNAME) \
324 @MAKE_ADA_SHAREDLIB@            $(LIBDIR)
325 @MAKE_ADA_SHAREDLIB@    cd $(LIBDIR) && $(LN_S) $(SHARED_LIBNAME) $(SHARED_SYMLINK)
326 @MAKE_ADA_SHAREDLIB@
327 @MAKE_ADA_SHAREDLIB@uninstall \
328 @MAKE_ADA_SHAREDLIB@uninstall.libs ::
329 @MAKE_ADA_SHAREDLIB@    $(SHELL) -c 'for name in $(BUILD_DIR)/dynamic-ali/* ; do rm -f $(ADA_OBJECTS)/`basename $$name`; done'
330 @MAKE_ADA_SHAREDLIB@
331 @MAKE_ADA_SHAREDLIB@uninstall \
332 @MAKE_ADA_SHAREDLIB@uninstall.libs ::
333 @MAKE_ADA_SHAREDLIB@    rm -f $(LIBDIR)/$(SHARED_SYMLINK)
334 @MAKE_ADA_SHAREDLIB@    rm -f $(LIBDIR)/$(SHARED_LIBNAME)
335
336 clean ::
337         rm -rf $(BUILD_DIR)/*-ali
338         rm -rf $(BUILD_DIR)/*-obj
339         rm -rf $(BUILD_DIR_LIB)