557c8a51de10a72ce46af70c7b5bb7c938540446
[ncurses.git] / Ada95 / src / Makefile.in
1 ##############################################################################
2 # Copyright (c) 1998-2015,2016 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.73 2016/09/18 00:25:32 tom Exp $
32 #
33 .SUFFIXES:
34
35 SHELL           = @SHELL@
36 VPATH           = @srcdir@
37 THIS            = Makefile
38
39 ADA_MFLAGS      = @cf_cv_makeflags@
40 @SET_MAKE@
41
42 MODEL           = ../../@DFT_OBJ_SUBDIR@
43
44 DESTDIR         = @DESTDIR@
45
46 top_srcdir      = @top_srcdir@
47 srcdir          = @srcdir@
48 prefix          = @prefix@
49 exec_prefix     = @exec_prefix@
50 includedir      = @includedir@
51 libdir          = @libdir@
52
53 LIBDIR          = $(DESTDIR)$(libdir)
54 ADA_INCLUDE     = $(DESTDIR)@ADA_INCLUDE@
55 ADA_OBJECTS     = $(DESTDIR)@ADA_OBJECTS@
56
57 INSTALL         = @INSTALL@
58 INSTALL_LIB     = @INSTALL@ @INSTALL_LIB@
59
60 AR              = @AR@
61 ARFLAGS         = @ARFLAGS@
62 AWK             = @AWK@
63 LN_S            = @LN_S@
64
65 CC              = @CC@
66 CFLAGS          = @CFLAGS@
67
68 CPPFLAGS        = @ACPPFLAGS@ @CPPFLAGS@ \
69                   -DHAVE_CONFIG_H -I$(srcdir)
70
71 CCFLAGS         = $(CPPFLAGS) $(CFLAGS)
72
73 CFLAGS_NORMAL   = $(CCFLAGS)
74 CFLAGS_DEBUG    = $(CCFLAGS) @CC_G_OPT@ -DTRACE
75 CFLAGS_PROFILE  = $(CCFLAGS) -pg
76 CFLAGS_SHARED   = $(CCFLAGS) @CC_SHARED_OPTS@
77
78 CFLAGS_DEFAULT  = $(CFLAGS_@DFT_UPR_MODEL@)
79
80 LINK            = $(CC)
81 LDFLAGS         = @LDFLAGS@ @LD_MODEL@ @LIBS@
82
83 RANLIB          = @RANLIB@
84
85 ################################################################################
86 ADA             = @cf_ada_compiler@
87 ADAPREP         = gnatprep
88 ADAFLAGS        = @ADAFLAGS@ -I. -I$(srcdir)
89
90 LIB_NAME        = AdaCurses
91 SONAME          = @ADA_SHAREDLIB@
92
93 GNAT_PROJECT    = AdaCurses.gpr
94
95 # build/source are the Ada95 tree
96 BUILD_DIR       = ..
97 SOURCE_DIR      = ..
98
99 BUILD_DIR_LIB   = $(BUILD_DIR)/lib
100 SOURCE_DIR_SRC  = $(SOURCE_DIR)/src
101
102 ADAMAKE         = @cf_ada_make@
103 ADAMAKEFLAGS    = \
104         -P$(GNAT_PROJECT) \
105         -XBUILD_DIR=`cd $(BUILD_DIR);pwd` \
106         -XSOURCE_DIR=`cd $(SOURCE_DIR);pwd` \
107         -XSOURCE_DIR2=`cd $(srcdir);pwd` \
108         -XLIB_NAME=$(LIB_NAME) \
109         -XSONAME=$(SONAME)
110
111 CARGS           = -cargs $(ADAFLAGS)
112 LARGS           =
113
114 STATIC_LIBNAME  = lib$(LIB_NAME).a
115 SHARED_LIBNAME  = $(SONAME)
116 SHARED_SYMLINK  = lib$(LIB_NAME).so
117
118 ALIB            = @cf_ada_package@
119 ABASE           = $(ALIB)-curses
120 ################################################################################
121 GENERATED_SOURCES=$(ABASE).ads                          \
122                   $(ABASE).adb                          \
123                   $(ABASE)-aux.ads                      \
124                   $(ABASE)-trace.ads                    \
125                   $(ABASE)-menus.ads                    \
126                   $(ABASE)-forms.ads                    \
127                   $(ABASE)-mouse.ads                    \
128                   $(ABASE)-panels.ads                   \
129                   $(ABASE)-menus-menu_user_data.ads     \
130                   $(ABASE)-menus-item_user_data.ads     \
131                   $(ABASE)-forms-form_user_data.ads     \
132                   $(ABASE)-forms-field_types.ads        \
133                   $(ABASE)-forms-field_user_data.ads    \
134                   $(ABASE)-panels-user_data.ads
135 ################################################################################
136 LIBOBJS=$(ALIB).o                                       \
137         $(ABASE)-aux.o                                  \
138         $(ABASE).o                                      \
139         $(ABASE)-terminfo.o                             \
140         $(ABASE)-termcap.o                              \
141         $(ABASE)-putwin.o                               \
142         $(ABASE)-trace.o                                \
143         $(ABASE)-mouse.o                                \
144         $(ABASE)-panels.o                               \
145         $(ABASE)-menus.o                                \
146         $(ABASE)-forms.o                                \
147         $(ABASE)-forms-field_types.o                    \
148         $(ABASE)-forms-field_types-alpha.o              \
149         $(ABASE)-forms-field_types-alphanumeric.o       \
150         $(ABASE)-forms-field_types-intfield.o           \
151         $(ABASE)-forms-field_types-numeric.o            \
152         $(ABASE)-forms-field_types-regexp.o             \
153         $(ABASE)-forms-field_types-enumeration.o        \
154         $(ABASE)-forms-field_types-ipv4_address.o       \
155         $(ABASE)-forms-field_types-user.o               \
156         $(ABASE)-forms-field_types-user-choice.o        \
157         $(ABASE)-text_io.o                              \
158         $(ABASE)-text_io-aux.o
159
160 # Ada object files for generic packages. Since gnat 3.10 they are
161 # also compiled
162 GENOBJS=$(ABASE)-menus-menu_user_data.o                 \
163         $(ABASE)-menus-item_user_data.o                 \
164         $(ABASE)-forms-form_user_data.o                 \
165         $(ABASE)-forms-field_user_data.o                \
166         $(ABASE)-forms-field_types-enumeration-ada.o    \
167         $(ABASE)-panels-user_data.o                     \
168         $(ABASE)-text_io-integer_io.o                   \
169         $(ABASE)-text_io-float_io.o                     \
170         $(ABASE)-text_io-fixed_io.o                     \
171         $(ABASE)-text_io-decimal_io.o                   \
172         $(ABASE)-text_io-enumeration_io.o               \
173         $(ABASE)-text_io-modular_io.o                   \
174         $(ABASE)-text_io-complex_io.o
175
176 all ::  $(BUILD_DIR_LIB)/$(STATIC_LIBNAME)
177         @echo done
178
179 $(ADA_INCLUDE) \
180 $(ADA_OBJECTS) \
181 $(LIBDIR) \
182 $(BUILD_DIR_LIB) :
183         mkdir -p $@
184
185 $(GENERATED_SOURCES) :
186         cd ../gen; $(MAKE) $(ADA_MFLAGS)
187
188 sources : $(GENERATED_SOURCES)
189         @echo made $@
190
191 libs \
192 install \
193 install.libs :: \
194                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME)
195         @echo made $(STATIC_LIBNAME)
196
197 install \
198 install.libs :: \
199                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) \
200                 $(ADA_OBJECTS)
201         @$(INSTALL_LIB) \
202                 $(BUILD_DIR_LIB)/$(STATIC_LIBNAME) \
203                 $(ADA_OBJECTS)
204
205 uninstall \
206 uninstall.libs ::
207         @rm -f $(ADA_OBJECTS)/$(STATIC_LIBNAME)
208
209 mostlyclean ::
210         rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a
211
212 clean :: mostlyclean
213         rm -f $(ABASE)-trace.adb
214
215 distclean :: clean
216         rm -f Makefile
217
218 realclean :: distclean
219
220 BASEDEPS=$(ABASE).ads $(ABASE)-aux.ads $(ABASE).adb
221
222 $(ABASE)-trace.adb : $(srcdir)/$(ABASE)-trace.adb_p
223         rm -f $@
224         $(ADAPREP) -DADA_TRACE=@ADA_TRACE@ @GNATPREP_OPTS@ $(srcdir)/$(ABASE)-trace.adb_p $@
225
226 ###############################################################################
227 # Use these definitions when building a shared library.
228 SHARED_C_OBJS   = c_varargs_to_ada.o c_threaded_variables.o ncurses_compat.o
229 SHARED_OBJS     = $(SHARED_C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
230
231 c_varargs_to_ada.o :    $(srcdir)/c_varargs_to_ada.c
232         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_varargs_to_ada.c
233
234 c_threaded_variables.o : $(srcdir)/c_threaded_variables.c
235         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/c_threaded_variables.c
236
237 ncurses_compat.o :      $(srcdir)/ncurses_compat.c
238         $(CC) $(CFLAGS_DEFAULT) -c -o $@ $(srcdir)/ncurses_compat.c
239
240 ###############################################################################
241 # Use these definitions when building a static library.
242 STATIC_C_OBJS   = static_c_varargs_to_ada.o static_c_threaded_variables.o static_ncurses_compat.o
243 STATIC_OBJS     = $(STATIC_C_OBJS) @USE_OLD_MAKERULES@$(LIBOBJS) @cf_generic_objects@
244
245 static_c_varargs_to_ada.o :     $(srcdir)/c_varargs_to_ada.c
246         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_varargs_to_ada.c
247
248 static_c_threaded_variables.o : $(srcdir)/c_threaded_variables.c
249         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/c_threaded_variables.c
250
251 static_ncurses_compat.o :       $(srcdir)/ncurses_compat.c
252         $(CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/ncurses_compat.c
253
254 ###############################################################################
255
256 @USE_OLD_MAKERULES@$(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
257 @USE_OLD_MAKERULES@             $(BUILD_DIR_LIB) \
258 @USE_OLD_MAKERULES@             $(STATIC_OBJS)
259 @USE_OLD_MAKERULES@     $(AR) $(ARFLAGS) $@ $(STATIC_OBJS)
260
261 $(BUILD_DIR)/static-ali : ; mkdir -p $@
262 $(BUILD_DIR)/static-obj : ; mkdir -p $@
263
264 STATIC_DIRS = \
265         $(BUILD_DIR_LIB) \
266         $(BUILD_DIR)/static-ali \
267         $(BUILD_DIR)/static-obj
268
269 @USE_GNAT_PROJECTS@$(BUILD_DIR_LIB)/$(STATIC_LIBNAME) :: \
270 @USE_GNAT_PROJECTS@             $(ABASE)-trace.adb \
271 @USE_GNAT_PROJECTS@             $(STATIC_C_OBJS) \
272 @USE_GNAT_PROJECTS@             $(STATIC_DIRS)
273 @USE_GNAT_PROJECTS@     $(SHELL) $(srcdir)/library-cfg.sh $(srcdir)/library.gpr $(CFLAGS_NORMAL) >$(GNAT_PROJECT)
274 @USE_GNAT_PROJECTS@     $(ADAMAKE) $(ADAMAKEFLAGS) -XLIB_KIND=static
275 @USE_GNAT_PROJECTS@     $(AR) $(ARFLAGS) $@ $(STATIC_C_OBJS)
276 @USE_GNAT_PROJECTS@     -rm -f $(GNAT_PROJECT)
277 @USE_GNAT_PROJECTS@
278 @USE_GNAT_LIBRARIES@install \
279 @USE_GNAT_LIBRARIES@install.libs :: \
280 @USE_GNAT_LIBRARIES@            $(ADA_OBJECTS)
281 @USE_GNAT_LIBRARIES@    $(INSTALL_LIB) \
282 @USE_GNAT_LIBRARIES@            $(BUILD_DIR)/static-ali/*.ali \
283 @USE_GNAT_LIBRARIES@            $(ADA_OBJECTS)
284
285 uninstall \
286 uninstall.libs ::
287         @rm -f $(ADA_OBJECTS)/$(STATIC_LIBNAME)
288
289 @USE_GNAT_LIBRARIES@uninstall \
290 @USE_GNAT_LIBRARIES@uninstall.libs ::
291 @USE_GNAT_LIBRARIES@    @$(SHELL) -c 'for name in $(BUILD_DIR)/static-ali/*.ali ; do rm -f $(ADA_OBJECTS)/`basename $$name`; done'
292
293 $(BUILD_DIR)/dynamic-ali : ; mkdir -p $@
294 $(BUILD_DIR)/dynamic-obj : ; mkdir -p $@
295
296 SHARED_DIRS = \
297         $(BUILD_DIR_LIB) \
298         $(BUILD_DIR)/dynamic-ali \
299         $(BUILD_DIR)/dynamic-obj
300
301 @MAKE_ADA_SHAREDLIB@all :: $(BUILD_DIR_LIB)/$(SHARED_LIBNAME)
302 @MAKE_ADA_SHAREDLIB@$(BUILD_DIR_LIB)/$(SHARED_LIBNAME) :: \
303 @MAKE_ADA_SHAREDLIB@            $(ABASE)-trace.adb \
304 @MAKE_ADA_SHAREDLIB@            $(SHARED_DIRS) \
305 @MAKE_ADA_SHAREDLIB@            $(SHARED_OBJS)
306 @MAKE_ADA_SHAREDLIB@    cp $(SHARED_OBJS) $(BUILD_DIR)/dynamic-obj/
307 @MAKE_ADA_SHAREDLIB@    $(SHELL) $(srcdir)/library-cfg.sh $(srcdir)/library.gpr $(CFLAGS_SHARED) >$(GNAT_PROJECT)
308 @MAKE_ADA_SHAREDLIB@    $(ADAMAKE) $(ADAMAKEFLAGS) -XLIB_KIND=dynamic
309 @MAKE_ADA_SHAREDLIB@    -rm -f $(GNAT_PROJECT)
310
311 install \
312 install.libs :: $(ADA_INCLUDE)
313         $(INSTALL_LIB) \
314                 $(SOURCE_DIR_SRC)/*.ad[sb] \
315                 $(ADA_INCLUDE)
316
317 install \
318 install.libs :: $(ADA_INCLUDE)
319         $(INSTALL_LIB) \
320                 $(GENERATED_SOURCES) \
321                 $(ADA_INCLUDE)
322
323 uninstall \
324 uninstall.libs ::
325         $(SHELL) -c 'for name in $(SOURCE_DIR_SRC)/*.ad[sb] $(GENERATED_SOURCES); do rm -f $(ADA_INCLUDE)/`basename $$name`; done'
326
327 @MAKE_ADA_SHAREDLIB@install \
328 @MAKE_ADA_SHAREDLIB@install.libs :: $(ADA_OBJECTS) $(LIBDIR)
329 @MAKE_ADA_SHAREDLIB@    $(INSTALL_LIB) \
330 @MAKE_ADA_SHAREDLIB@            $(BUILD_DIR)/dynamic-ali/* \
331 @MAKE_ADA_SHAREDLIB@            $(ADA_OBJECTS)
332 @MAKE_ADA_SHAREDLIB@    $(INSTALL_LIB) \
333 @MAKE_ADA_SHAREDLIB@            $(BUILD_DIR_LIB)/$(SHARED_LIBNAME) \
334 @MAKE_ADA_SHAREDLIB@            $(LIBDIR)
335 @MAKE_ADA_SHAREDLIB@    cd $(LIBDIR) && $(LN_S) $(SHARED_LIBNAME) $(SHARED_SYMLINK)
336 @MAKE_ADA_SHAREDLIB@
337 @MAKE_ADA_SHAREDLIB@uninstall \
338 @MAKE_ADA_SHAREDLIB@uninstall.libs ::
339 @MAKE_ADA_SHAREDLIB@    $(SHELL) -c 'for name in $(BUILD_DIR)/dynamic-ali/* ; do rm -f $(ADA_OBJECTS)/`basename $$name`; done'
340 @MAKE_ADA_SHAREDLIB@
341 @MAKE_ADA_SHAREDLIB@uninstall \
342 @MAKE_ADA_SHAREDLIB@uninstall.libs ::
343 @MAKE_ADA_SHAREDLIB@    rm -f $(LIBDIR)/$(SHARED_SYMLINK)
344 @MAKE_ADA_SHAREDLIB@    rm -f $(LIBDIR)/$(SHARED_LIBNAME)
345
346 clean ::
347         rm -rf $(BUILD_DIR)/*-ali
348         rm -rf $(BUILD_DIR)/*-obj
349         rm -rf $(BUILD_DIR_LIB)