Moved GNU spec stuff into Makefile.bsd-wrapper1 using PREREQ variable.
authoretheisen <etheisen@openbsd.org>
Thu, 28 Mar 1996 07:31:07 +0000 (07:31 +0000)
committeretheisen <etheisen@openbsd.org>
Thu, 28 Mar 1996 07:31:07 +0000 (07:31 +0000)
This makes full BSD build support a reality for libiberty.  make obj
tags depends now works.  General cleanup and commenting.

gnu/lib/libg++/libiberty/Makefile.bsd-wrapper
gnu/lib/libg++/libiberty/Makefile.bsd-wrapper1 [new file with mode: 0644]
gnu/lib/libg++/libstdc++/Makefile.bsd-wrapper

index effdc51..24ffed2 100644 (file)
@@ -1,73 +1,27 @@
-#      $OpenBSD: Makefile.bsd-wrapper,v 1.2 1996/03/27 23:00:03 niklas Exp $
+#      $OpenBSD: Makefile.bsd-wrapper,v 1.3 1996/03/28 07:31:07 etheisen Exp $
 
 LIB=           iberty
 CPPFLAGS+=     -I$(.CURDIR) -I$(.CURDIR)/../include -I$(.OBJDIR)
 
-# You must do a GNU build and then examine needed-list
-# and config.h to determine HOST_FILES value.
-HOST_FILES=    insque.c
+# XXX -- GNUism
+# As we need to fill variables with contents of dynamically created files
+# we must first see to that they are really generated.  This is a hack that
+# ensures this.  The echo at the end is because make doesn't like command
+# substitutions to not generate output.
+PREREQ!=       test ! -f $(.OBJDIR)/needed-list && \
+                       (cd $(.CURDIR); \
+                        $(MAKE) -f Makefile.bsd-wrapper1); \
+               echo 'Prerequistes made'
+HOST_FILES!=   cat $(.OBJDIR)/needed-list
+
 SRCS=          argv.c basename.c concat.c cplus-dem.c fdmatch.c \
                getopt.c getopt1.c getruntime.c hex.c \
                floatformat.c obstack.c spaces.c strerror.c strsignal.c \
                vasprintf.c xatexit.c xexit.c xmalloc.c xstrerror.c \
                $(HOST_FILES)
 
-CLEANFILES+=   alloca-conf.h needed-list $(NEEDED_LIST) config.h needed.awk \
-               needed2.awk errors dummy dummy.o
-
-all: alloca-conf.h config.h needed-list
-
-beforedepend: alloca-conf.h config.h needed-list
-
-alloca-conf.h:
-       @echo Creating $(.TARGET) symlink
-       @ln -s $(.CURDIR)/alloca-norm.h alloca-conf.h
-
-# The following is from the GNU makefile
-NEEDED_LIST=   lneeded-list
-EXTRA_OFILES=
-
-needed-list: $(NEEDED_LIST)
-       @cp $(NEEDED_LIST) needed-list
-
-lneeded-list: $(EXTRA_OFILES) needed.awk errors
-       @echo Generating needed-list
-       @rm -f lneeded-list
-       @f=""; \
-       for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
-         case " $$f " in \
-           *" $$i "*) ;; \
-           *) f="$$f $$i" ;; \
-         esac ; \
-       done ; \
-       echo $$f >>lneeded-list
-
-needed.awk: functions.def
-       @echo "# !Automatically generated from $(.CURDIR)/functions.def"\
-         "- DO NOT EDIT!" >needed.awk
-       @grep '^DEF(' < $(.CURDIR)/functions.def \
-           | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
-           >>needed.awk
-
-config.h: needed2.awk errors
-       @echo Generating $(.TARGET)
-       @echo "/* !Automatically generated from $(.CURDIR)/functions.def"\
-               "- DO NOT EDIT! */" >config.h
-       @awk -f needed2.awk <errors >>config.h
-
-needed2.awk: functions.def
-       @echo "# !Automatically generated from $(.CURDIR)/functions.def"\
-               "- DO NOT EDIT!" >needed2.awk
-       @grep '^DEFVAR(' < $(.CURDIR)/functions.def \
-               | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|'  >>needed2.awk
-       @grep '^DEFFUNC(' < $(.CURDIR)/functions.def \
-               | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' >>needed2.awk
-
-dummy.o: dummy.c alloca-conf.h functions.def
-       @echo Generating $(.TARGET)
-       @$(CC) -c $(CFLAGS) $(CPPFLAGS) $(.IMPSRC) 2>/dev/null
-
-errors: dummy.o
-       @-($(CC) -o dummy $(CFLAGS) $(LDFLAGS) dummy.o) >errors 2>&1 || true
+# XXX -- These files are generated during the PREREQ variable assignment.
+CLEANFILES+=   alloca-conf.h config.h dummy dummy.o errors lconfig.h \
+               lneeded-list needed-list needed.awk needed2.awk stamp-picdir
 
 .include <bsd.lib.mk>
diff --git a/gnu/lib/libg++/libiberty/Makefile.bsd-wrapper1 b/gnu/lib/libg++/libiberty/Makefile.bsd-wrapper1
new file mode 100644 (file)
index 0000000..120e3f2
--- /dev/null
@@ -0,0 +1,76 @@
+#      $OpenBSD: Makefile.bsd-wrapper1,v 1.1 1996/03/28 07:31:08 etheisen Exp $
+#
+#      XXX -- GNUism
+#      This file's only purpose to help isolate
+#       the funky GNU build mechanism!
+#
+CPPFLAGS+=      -I$(.CURDIR) -I$(.CURDIR)/../include -I$(.OBJDIR)
+
+all:           alloca-conf.h config.h needed-list
+
+alloca-conf.h: alloca-norm.h
+       @echo Creating $(.TARGET) symlink
+       @ln -s $(.ALLSRC) $(.TARGET)
+#
+# The following is more or less straight from the GNU makefile
+# with pmake-isms added were needed.  Note that needed-list
+# now contains .c's instead of .o's.
+#
+CONFIG_H = lconfig.h
+NEEDED_LIST = lneeded-list
+EXTRA_OFILES =
+
+needed-list: stamp-picdir $(NEEDED_LIST)
+       cp $(NEEDED_LIST) needed-list
+
+lneeded-list: $(EXTRA_OFILES) needed.awk errors
+       rm -f lneeded-list
+       f=""; \
+       for i in `awk -f needed.awk <errors` $(EXTRA_OFILES) ; do \
+         case " $$f " in \
+           *" $$i "*) ;; \
+           *) f="$$f $$i" ;; \
+         esac ; \
+       done ; \
+       echo $$f >>lneeded-list
+
+# Generate an awk script that looks for functions in functions.def
+
+needed.awk: $(.CURDIR)/functions.def
+       echo "# !Automatically generated from $(.CURDIR)/functions.def"\
+         "- DO NOT EDIT!" >needed.awk
+       grep '^DEF(' < $(.CURDIR)/functions.def \
+           | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.c " }|' \
+           >>needed.awk
+
+config.h: $(CONFIG_H)
+       cp $(CONFIG_H) config.h
+
+lconfig.h: needed2.awk errors
+       echo "/* !Automatically generated from $(.CURDIR)/functions.def"\
+         "- DO NOT EDIT! */" >lconfig.h
+       awk -f needed2.awk <errors >>lconfig.h
+
+# Generate an awk script that looks for variables in functions.def
+
+needed2.awk: $(.CURDIR)/functions.def
+       echo "# !Automatically generated from $(.CURDIR)/functions.def"\
+         "- DO NOT EDIT!" >needed2.awk
+       grep '^DEFVAR(' < $(.CURDIR)/functions.def \
+        | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
+        >>needed2.awk
+       grep '^DEFFUNC(' < $(.CURDIR)/functions.def \
+        | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
+        >>needed2.awk
+
+dummy.o: $(.CURDIR)/dummy.c alloca-conf.h $(.CURDIR)/functions.def
+       -$(CC) -c $(CFLAGS) $(CPPFLAGS) $(HDEFINES) $(.CURDIR)/dummy.c 2>/dev/null
+
+errors: dummy.o $(EXTRA_OFILES)
+       -($(CC) -o dummy $(CFLAGS) $(LDFLAGS) $(ERRORS_LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
+
+stamp-picdir:
+       if [ -n "$(PICFLAG)" ] && [ ! -d pic ]; then \
+         mkdir pic; \
+       else true; fi
+       touch stamp-picdir
\ No newline at end of file
index be5240a..260171b 100644 (file)
@@ -1,4 +1,4 @@
-#      $OpenBSD: Makefile.bsd-wrapper,v 1.3 1996/03/27 23:00:05 niklas Exp $
+#      $OpenBSD: Makefile.bsd-wrapper,v 1.4 1996/03/28 07:31:10 etheisen Exp $
 
 LIB=           stdc++
 CXXFLAGS+=     -fno-implicit-templates -nostdinc++
@@ -53,7 +53,8 @@ PREREQ!=      test ! -f $(IO_OBJDIR)/iostream.list && \
 IO_OBJS!=      cat $(IO_OBJDIR)/iostream.list
 QIO_OBJS=      $(IO_OBJS:S/^/$(IO_OBJDIR)\//g)
 
-LIBIBERTY_OBJS!=cat $(LIBIBERTY_OBJDIR)/needed-list
+LIBIBERTY_SRCS!=cat $(LIBIBERTY_OBJDIR)/needed-list
+LIBIBERTY_OBJS=$(LIBIBERTY_SRCS:N*.h:R:S/$/.o/g)
 # XXX why does strerror.o need to be hardwired?
 LIBIBERTY_OBJS+=strerror.o
 QLIBIBERTY_OBJS=$(LIBIBERTY_OBJS:S/^/$(LIBIBERTY_OBJDIR)\//g)