summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-04-24 16:08:46 +0200
committerMichael Stahl <mstahl@redhat.com>2013-04-24 17:37:46 +0200
commit7019a1c67473623cb81ca0c9e155b90a5ce6947a (patch)
tree8a1db39a43b28aa9673133a2e6bb2a7cd8a91e40
parentced9e2abecbbdf70acb3ca46c5e6a6d4247015c0 (diff)
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
-rw-r--r--solenv/gbuild/platform/WNT_INTEL_GCC.mk10
-rw-r--r--solenv/gbuild/platform/com_MSC_class.mk20
-rw-r--r--solenv/gbuild/processdeps.awk73
-rw-r--r--soltools/mkdepend/def.h1
-rw-r--r--soltools/mkdepend/main.c12
-rw-r--r--soltools/mkdepend/pr.c34
6 files changed, 52 insertions, 98 deletions
diff --git a/solenv/gbuild/platform/WNT_INTEL_GCC.mk b/solenv/gbuild/platform/WNT_INTEL_GCC.mk
index 2acbc6ca0318..8df958f12c2f 100644
--- a/solenv/gbuild/platform/WNT_INTEL_GCC.mk
+++ b/solenv/gbuild/platform/WNT_INTEL_GCC.mk
@@ -362,13 +362,9 @@ $(call gb_Helper_abbreviate_dirs,\
$(INCLUDE) \
$(DEFS) \
$(RCFILE) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(3) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- > $(1))
+ -o .res \
+ -p $(dir $(3)) \
+ -f $(1))
endef
else
gb_WinResTarget__command_target =
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 92b8e03a384a..94db603d6c13 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -484,13 +484,9 @@ $(call gb_Helper_abbreviate_dirs,\
$(INCLUDE) \
$(DEFS) \
$(2) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(call gb_SrsPartTarget_get_target,$(1)) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- > $(call gb_SrsPartTarget_get_dep_target,$(1)))
+ -o .src \
+ -p $(dir $(call gb_SrsPartTarget_get_target,$(1))) \
+ -f $(call gb_SrsPartTarget_get_dep_target,$(1)))
endef
else
gb_SrsPartTarget__command_target =
@@ -532,13 +528,9 @@ $(call gb_Helper_abbreviate_dirs,\
$(INCLUDE) \
$(DEFS) \
$(RCFILE) \
- -f - \
- | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
- -v OBJECTFILE=$(3) \
- -v OUTDIR=$(OUTDIR)/ \
- -v WORKDIR=$(WORKDIR)/ \
- -v SRCDIR=$(SRCDIR)/ \
- > $(1))
+ -o .res \
+ -p $(dir $(3)) \
+ -f $(1))
endef
else
gb_WinResTarget__command_target =
diff --git a/solenv/gbuild/processdeps.awk b/solenv/gbuild/processdeps.awk
deleted file mode 100644
index e564b0babd76..000000000000
--- a/solenv/gbuild/processdeps.awk
+++ /dev/null
@@ -1,73 +0,0 @@
-#*************************************************************************
-#
-# 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";
-}
diff --git a/soltools/mkdepend/def.h b/soltools/mkdepend/def.h
index 1ec838231d68..1c0e91a811c9 100644
--- a/soltools/mkdepend/def.h
+++ b/soltools/mkdepend/def.h
@@ -181,6 +181,7 @@ void add_include(struct filepointer *filep, struct inclist *file,
int match(register char *str, register char **list);
void recursive_pr_include(register struct inclist *head, register char *file,
register char *base);
+void recursive_pr_dummy(register struct inclist *head, register char *file);
void inc_clean();
void fatalerr(char *, ...);
diff --git a/soltools/mkdepend/main.c b/soltools/mkdepend/main.c
index 5beb8fdf981e..149bae1e62da 100644
--- a/soltools/mkdepend/main.c
+++ b/soltools/mkdepend/main.c
@@ -461,6 +461,9 @@ int main(argc, argv)
freefile(filecontent);
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();
}
if (printed)
@@ -660,6 +663,14 @@ void redirect(line, makefile)
char *line,
*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;
FILE *fdin, *fdout;
char backup[ BUFSIZ ],
@@ -724,6 +735,7 @@ void redirect(line, makefile)
fchmod(fileno(fdout), st.st_mode);
#endif /* USGISH */
fclose(fdin);
+#endif
}
void fatalerr(char *msg, ...)
diff --git a/soltools/mkdepend/pr.c b/soltools/mkdepend/pr.c
index f472f28ebd75..e6200781b465 100644
--- a/soltools/mkdepend/pr.c
+++ b/soltools/mkdepend/pr.c
@@ -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)
register struct inclist *head;
register char *file, *base;
@@ -105,16 +128,19 @@ size_t pr(ip, file, base)
char buf[ BUFSIZ ];
printed = TRUE;
- len = (int)strlen(ip->i_file)+1;
- if (current_len + len > width || file != lastfile) {
+ len = (int)strlen(ip->i_file)+4;
+ if (file != lastfile) {
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);
len = current_len = (int)strlen(buf);
}
else {
buf[0] = ' ';
- strcpy(buf+1, ip->i_file);
+ buf[1] = '\\';
+ buf[2] = '\n';
+ buf[3] = ' ';
+ strcpy(buf+4, ip->i_file);
current_len += len;
}
ret = fwrite(buf, len, 1, stdout);