Kaydet (Commit) 7019a1c6 authored tarafından Michael Stahl's avatar Michael Stahl

gbuild: get rid of processdeps.awk

The only thing that processdeps.awk does that is actually useful is to
be able to set the target name freely, but that is only important for
the default resource file which was just renamed.

Instead hack makedepend to provide the required functionality directly:
- write dummy rules for included files so builds don't break on
  rename/removal
- format deps one per line like concat-deps expects
- concat-deps expects standard POSIX line ends, so open in binary mode
  (also disable that awful backup copying nonsense)

Though in retrospect it would perhaps be a better investment of time to
try to replace makedepend...

Change-Id: I54fafdcdcf1a52692e62b8f1f4b96fb9a93d4421
üst ced9e2ab
...@@ -362,13 +362,9 @@ $(call gb_Helper_abbreviate_dirs,\ ...@@ -362,13 +362,9 @@ $(call gb_Helper_abbreviate_dirs,\
$(INCLUDE) \ $(INCLUDE) \
$(DEFS) \ $(DEFS) \
$(RCFILE) \ $(RCFILE) \
-f - \ -o .res \
| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ -p $(dir $(3)) \
-v OBJECTFILE=$(3) \ -f $(1))
-v OUTDIR=$(OUTDIR)/ \
-v WORKDIR=$(WORKDIR)/ \
-v SRCDIR=$(SRCDIR)/ \
> $(1))
endef endef
else else
gb_WinResTarget__command_target = gb_WinResTarget__command_target =
......
...@@ -484,13 +484,9 @@ $(call gb_Helper_abbreviate_dirs,\ ...@@ -484,13 +484,9 @@ $(call gb_Helper_abbreviate_dirs,\
$(INCLUDE) \ $(INCLUDE) \
$(DEFS) \ $(DEFS) \
$(2) \ $(2) \
-f - \ -o .src \
| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ -p $(dir $(call gb_SrsPartTarget_get_target,$(1))) \
-v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \ -f $(call gb_SrsPartTarget_get_dep_target,$(1)))
-v OUTDIR=$(OUTDIR)/ \
-v WORKDIR=$(WORKDIR)/ \
-v SRCDIR=$(SRCDIR)/ \
> $(call gb_SrsPartTarget_get_dep_target,$(1)))
endef endef
else else
gb_SrsPartTarget__command_target = gb_SrsPartTarget__command_target =
...@@ -532,13 +528,9 @@ $(call gb_Helper_abbreviate_dirs,\ ...@@ -532,13 +528,9 @@ $(call gb_Helper_abbreviate_dirs,\
$(INCLUDE) \ $(INCLUDE) \
$(DEFS) \ $(DEFS) \
$(RCFILE) \ $(RCFILE) \
-f - \ -o .res \
| $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \ -p $(dir $(3)) \
-v OBJECTFILE=$(3) \ -f $(1))
-v OUTDIR=$(OUTDIR)/ \
-v WORKDIR=$(WORKDIR)/ \
-v SRCDIR=$(SRCDIR)/ \
> $(1))
endef endef
else else
gb_WinResTarget__command_target = gb_WinResTarget__command_target =
......
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
# this awk script mangles makedepend output for a single object file
# usage:
# awk -f .../processdeps.awk \
# -v OUTDIR=outdir \
# -v SRCDIR=srcdir \
# -v WORKDIR=workdir \
# -v OBJECTFILE=objectfile
# called like this the script will read from stdin
# and write to stdout. It will:
# - replace the objectfile with the one given on the commandline
# - normalize paths to mixed paths (replacing all \ with /)
# - replace the string given as WORKDIR with $(WORKDIR)/
# - replace the string given as OUTDIR with $(OUTDIR)/
# - replace the string given as SRCDIR with $(SRCDIR)/
# - translates absolute mixed windows paths to cygwin paths by
# substituting a path starting with X:... to /cygdrive/X/...
function mangle_path(path) {
gsub("\\\\", "/", path);
if( path ~ /^[a-zA-Z]:/ )
path = tolower(substr(path,0,1)) substr(path,2);
gsub(WORKDIR, "$(WORKDIR)/", path);
gsub(OUTDIR, "$(OUTDIR)/", path);
gsub(SRCDIR, "$(SRCDIR)/", path);
if( path ~ /^[a-zA-Z]:/ )
path = "/cygdrive/" tolower(substr(path,0,1)) substr(path,3);
return path;
}
BEGIN {
WORKDIR = tolower(substr(WORKDIR,0,1)) substr(WORKDIR,2);
OUTDIR = tolower(substr(OUTDIR,0,1)) substr(OUTDIR,2);
SRCDIR = tolower(substr(SRCDIR,0,1)) substr(SRCDIR,2);
# print "# WORKDIR=" WORKDIR;
# print "# OUTDIR=" OUTDIR;
# print "# SRCDIR=" SRCDIR;
print mangle_path(OBJECTFILE) ": \\";
}
/^[^#]/ {
print "\t" mangle_path($2) " \\";
}
END {
print "\n";
}
...@@ -181,6 +181,7 @@ void add_include(struct filepointer *filep, struct inclist *file, ...@@ -181,6 +181,7 @@ void add_include(struct filepointer *filep, struct inclist *file,
int match(register char *str, register char **list); int match(register char *str, register char **list);
void recursive_pr_include(register struct inclist *head, register char *file, void recursive_pr_include(register struct inclist *head, register char *file,
register char *base); register char *base);
void recursive_pr_dummy(register struct inclist *head, register char *file);
void inc_clean(); void inc_clean();
void fatalerr(char *, ...); void fatalerr(char *, ...);
......
...@@ -461,6 +461,9 @@ int main(argc, argv) ...@@ -461,6 +461,9 @@ int main(argc, argv)
freefile(filecontent); freefile(filecontent);
recursive_pr_include(ip, ip->i_file, base_name(*fp)); recursive_pr_include(ip, ip->i_file, base_name(*fp));
if (printed)
fwrite("\n\n", 2, 1, stdout);
recursive_pr_dummy(ip, ip->i_file);
inc_clean(); inc_clean();
} }
if (printed) if (printed)
...@@ -660,6 +663,14 @@ void redirect(line, makefile) ...@@ -660,6 +663,14 @@ void redirect(line, makefile)
char *line, char *line,
*makefile; *makefile;
{ {
FILE *fdout;
fdout = freopen(makefile, "wb", stdout); // binary mode please
if (fdout == NULL)
fatalerr("cannot open \"%s\"\n", makefile);
(void) line;
// don't need any of that nonsense
#if 0
struct stat st; struct stat st;
FILE *fdin, *fdout; FILE *fdin, *fdout;
char backup[ BUFSIZ ], char backup[ BUFSIZ ],
...@@ -724,6 +735,7 @@ void redirect(line, makefile) ...@@ -724,6 +735,7 @@ void redirect(line, makefile)
fchmod(fileno(fdout), st.st_mode); fchmod(fileno(fdout), st.st_mode);
#endif /* USGISH */ #endif /* USGISH */
fclose(fdin); fclose(fdin);
#endif
} }
void fatalerr(char *msg, ...) void fatalerr(char *msg, ...)
......
...@@ -79,6 +79,29 @@ void add_include(struct filepointer *filep, struct inclist *file, struct inclist ...@@ -79,6 +79,29 @@ void add_include(struct filepointer *filep, struct inclist *file, struct inclist
} }
} }
void pr_dummy(ip)
register struct inclist *ip;
{
fwrite(ip->i_file, strlen(ip->i_file), 1, stdout);
fwrite(" :\n\n", 4, 1, stdout);
}
void recursive_pr_dummy(head, file)
register struct inclist *head;
register char *file;
{
register int i;
if (head->i_marked == 2)
return;
head->i_marked = 2; // it's a large boolean...
if (head->i_file != file)
pr_dummy(head, file);
for (i=0; i<head->i_listlen; i++)
recursive_pr_dummy(head->i_list[ i ], file);
}
void recursive_pr_include(head, file, base) void recursive_pr_include(head, file, base)
register struct inclist *head; register struct inclist *head;
register char *file, *base; register char *file, *base;
...@@ -105,16 +128,19 @@ size_t pr(ip, file, base) ...@@ -105,16 +128,19 @@ size_t pr(ip, file, base)
char buf[ BUFSIZ ]; char buf[ BUFSIZ ];
printed = TRUE; printed = TRUE;
len = (int)strlen(ip->i_file)+1; len = (int)strlen(ip->i_file)+4;
if (current_len + len > width || file != lastfile) { if (file != lastfile) {
lastfile = file; lastfile = file;
sprintf(buf, "\n%s%s%s: %s", objprefix, base, objsuffix, sprintf(buf, "\n%s%s%s: \\\n %s", objprefix, base, objsuffix,
ip->i_file); ip->i_file);
len = current_len = (int)strlen(buf); len = current_len = (int)strlen(buf);
} }
else { else {
buf[0] = ' '; buf[0] = ' ';
strcpy(buf+1, ip->i_file); buf[1] = '\\';
buf[2] = '\n';
buf[3] = ' ';
strcpy(buf+4, ip->i_file);
current_len += len; current_len += len;
} }
ret = fwrite(buf, len, 1, stdout); ret = fwrite(buf, len, 1, stdout);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment