1
# $Id: mk-1st.awk,v 1.65 2005/06/18 19:15:57 tom Exp $
1
# $Id: mk-1st.awk,v 1.68 2006/10/08 00:14:08 tom Exp $
2
2
##############################################################################
3
# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. #
3
# Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. #
5
5
# Permission is hereby granted, free of charge, to any person obtaining a #
6
6
# copy of this software and associated documentation files (the "Software"), #
32
32
# Generate list of objects for a given model library
34
# name (library name, e.g., "ncurses", "panel", "forms", "menus")
35
# traces ("all" or "DEBUG", to control whether tracing is compiled in)
36
# MODEL (e.g., "DEBUG", uppercase; toupper is not portable)
37
# model (directory into which we compile, e.g., "obj")
38
# prefix (e.g., "lib", for Unix-style libraries)
39
# suffix (e.g., "_g.a", for debug libraries)
40
# subset ("none", "base", "base+ext_funcs" or "termlib")
41
# ShlibVer ("rel", "abi" or "auto", to augment DoLinks variable)
34
# name (library name, e.g., "ncurses", "panel", "forms", "menus")
35
# traces ("all" or "DEBUG", to control whether tracing is compiled in)
36
# MODEL (e.g., "DEBUG", uppercase; toupper is not portable)
37
# model (directory into which we compile, e.g., "obj")
38
# prefix (e.g., "lib", for Unix-style libraries)
39
# suffix (e.g., "_g.a", for debug libraries)
40
# subset ("none", "base", "base+ext_funcs" or "termlib")
41
# ShlibVer ("rel", "abi" or "auto", to augment DoLinks variable)
42
42
# ShlibVerInfix ("yes" or "no", determines location of version #)
43
# DoLinks ("yes", "reverse" or "no", flag to add symbolic links)
44
# rmSoLocs ("yes" or "no", flag to add extra clean target)
45
# ldconfig (path for this tool, if used)
46
# overwrite ("yes" or "no", flag to add link to libcurses.a
47
# depend (optional dependencies for all objects, e.g, ncurses_cfg.h)
48
# host (cross-compile host, if any)
43
# DoLinks ("yes", "reverse" or "no", flag to add symbolic links)
44
# rmSoLocs ("yes" or "no", flag to add extra clean target)
45
# ldconfig (path for this tool, if used)
46
# overwrite ("yes" or "no", flag to add link to libcurses.a
47
# depend (optional dependencies for all objects, e.g, ncurses_cfg.h)
48
# host (cross-compile host, if any)
51
51
# CLIXs nawk does not like underscores in command-line variable names.
52
# Mixed-case variable names are ok.
53
53
# HP/UX requires shared libraries to have executable permissions.
55
55
function symlink(src,dst) {
106
function shlib_rule(directory) {
107
if ( ShlibVer == "cygdll" ) {
108
dst_libs = sprintf("%s/$(SHARED_LIB) %s/$(IMPORT_LIB)", directory, directory);
110
dst_libs = sprintf("%s/%s", directory, end_name);
112
printf "%s : %s $(%s_OBJS)\n", dst_libs, directory, OBJS
113
printf "\t@echo linking $@\n"
114
print "\t-@rm -f %s", dst_libs;
115
if ( subset == "termlib" || subset == "termlib+ext_tinfo" ) {
116
make_shlib(OBJS, "TINFO_LIST")
118
make_shlib(OBJS, "SHLIB_LIST")
120
sharedlinks(directory)
122
function install_dll(directory,filename) {
123
src_name = sprintf("../lib/%s", filename);
124
dst_name = sprintf("$(DESTDIR)%s/%s", directory, filename);
125
printf "\t@echo installing %s as %s\n", src_name, dst_name
126
printf "\t-@rm -f %s\n", dst_name
127
if ( directory == "$(bindir)" ) {
128
program = "$(INSTALL) -m 755";
130
program = "$(INSTALL_LIB)";
132
printf "\t%s %s %s\n", program, src_name, dst_name
238
print "install.libs \\"
203
240
if ( ShlibVer == "cygdll" ) {
204
242
dst_dirs = "$(DESTDIR)$(bindir) $(DESTDIR)$(libdir)";
205
printf "$(SHARED_LIB) $(IMPORT_LIB) : $(%s_OBJS)\n", OBJS;
206
print "\t-@rm -f $(SHARED_LIB) $(IMPORT_LIB)";
208
dst_dirs = "$(DESTDIR)$(libdir)";
209
printf "../lib/%s : $(%s_OBJS)\n", end_name, OBJS
210
print "\t-@rm -f $@";
212
if ( subset == "termlib" || subset == "termlib+ext_tinfo" ) {
213
printf "\t$(MK_SHARED_LIB) $(%s_OBJS) $(TINFO_LIST) $(LDFLAGS)\n", OBJS
215
printf "\t$(MK_SHARED_LIB) $(%s_OBJS) $(SHLIB_LIST) $(LDFLAGS)\n", OBJS
217
sharedlinks("../lib")
221
print "install.libs \\"
222
printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs
224
if ( ShlibVer == "cygdll" ) {
226
src_name = sprintf("../lib/%s", end_name);
227
dst_name = sprintf("$(DESTDIR)$(bindir)/%s", end_name);
228
printf "\t@echo installing %s as %s\n", src_name, dst_name
229
printf "\t-@rm -f %s\n", dst_name
230
printf "\t$(INSTALL_LIB) %s %s\n", src_name, dst_name
232
src_name = sprintf("../lib/%s", imp_name);
233
dst_name = sprintf("$(DESTDIR)$(libdir)/%s", imp_name);
234
printf "\t@echo installing %s as %s\n", src_name, dst_name
235
printf "\t-@rm -f %s\n", dst_name
236
printf "\t$(INSTALL_LIB) %s %s\n", src_name, dst_name
240
src_name = sprintf("../lib/%s", end_name);
241
dst_name = sprintf("$(DESTDIR)$(libdir)/%s", end_name);
242
printf "\t@echo installing %s as %s\n", src_name, dst_name
243
printf "\t-@rm -f %s\n", dst_name
244
printf "\t$(INSTALL_LIB) %s %s\n", src_name, dst_name
246
sharedlinks("$(DESTDIR)$(libdir)")
243
printf "install.%s :: %s $(LIBRARIES)\n", name, dst_dirs
244
install_dll("$(bindir)",end_name);
245
install_dll("$(libdir)",imp_name);
249
lib_dir = "$(DESTDIR)$(libdir)";
250
printf "install.%s :: %s/%s\n", name, lib_dir, end_name
250
255
if ( overwrite == "yes" && name == "ncurses" )