diff options
Diffstat (limited to 'dmake/unix')
124 files changed, 10537 insertions, 0 deletions
diff --git a/dmake/unix/386ix/ar.h b/dmake/unix/386ix/ar.h new file mode 100644 index 000000000000..4c38e8944e99 --- /dev/null +++ b/dmake/unix/386ix/ar.h @@ -0,0 +1,27 @@ +/* RCS $Id: ar.h,v 1.1.1.1 2000-09-22 15:33:33 hr Exp $ +-- +-- SYNOPSIS +-- ar header +-- +-- DESCRIPTION +-- Make sure that PORTAR is defined. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#define PORTAR 1 +#include "/usr/include/ar.h" diff --git a/dmake/unix/386ix/config.mk b/dmake/unix/386ix/config.mk new file mode 100644 index 000000000000..4c1eac92b94d --- /dev/null +++ b/dmake/unix/386ix/config.mk @@ -0,0 +1,27 @@ +# This is the 386IX UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/386ix/make.sh b/dmake/unix/386ix/make.sh new file mode 100644 index 000000000000..68e0109bb576 --- /dev/null +++ b/dmake/unix/386ix/make.sh @@ -0,0 +1,60 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/386ix -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/386ix -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/386ix -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/386ix -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/386ix -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/386ix -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/386ix -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/386ix -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/386ix -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/386ix -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/386ix -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/386ix -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/386ix -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/386ix -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/386ix -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/386ix -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/386ix -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/386ix -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/386ix -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/386ix -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/386ix -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/386ix -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/386ix -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/386ix -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/386ix -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/386ix -O unix/dcache.c +mv dcache.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o +cp unix/386ix/template.mk startup/config.mk diff --git a/dmake/unix/386ix/public.h b/dmake/unix/386ix/public.h new file mode 100644 index 000000000000..25a7778312be --- /dev/null +++ b/dmake/unix/386ix/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:53:49 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/386ix/stdlib.h b/dmake/unix/386ix/stdlib.h new file mode 100644 index 000000000000..1ec47228432b --- /dev/null +++ b/dmake/unix/386ix/stdlib.h @@ -0,0 +1,44 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:33 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); +extern free(); +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/386ix/template.mk b/dmake/unix/386ix/template.mk new file mode 100644 index 000000000000..e59d37c7ca72 --- /dev/null +++ b/dmake/unix/386ix/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= 386ix + OSENVIRONMENT *:= diff --git a/dmake/unix/386ix/time.h b/dmake/unix/386ix/time.h new file mode 100644 index 000000000000..aff117b02ade --- /dev/null +++ b/dmake/unix/386ix/time.h @@ -0,0 +1,35 @@ +/* RCS $Id: time.h,v 1.1.1.1 2000-09-22 15:33:33 hr Exp $ +-- +-- SYNOPSIS +-- time_t +-- +-- DESCRIPTION +-- Properly define time_t. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/* +** Berkeley get this wrong! +*/ +#ifndef TIME_h +#define TIME_h + +typedef long time_t; /* this is the thing we use */ + +#endif TIME_h + diff --git a/dmake/unix/Makefile.am b/dmake/unix/Makefile.am new file mode 100755 index 000000000000..e92c23ae9275 --- /dev/null +++ b/dmake/unix/Makefile.am @@ -0,0 +1,7 @@ + +noinst_LIBRARIES = libunix.a + +libunix_a_SOURCES = arlib.c dcache.c dirbrk.c rmprq.c ruletab.c runargv.c tempnam.c + + +INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/unix/@OS_VERSION@/gnu -I$(top_srcdir)/unix -I$(top_srcdir)/unix/@OS_VERSION@ diff --git a/dmake/unix/Makefile.in b/dmake/unix/Makefile.in new file mode 100755 index 000000000000..c46390514170 --- /dev/null +++ b/dmake/unix/Makefile.in @@ -0,0 +1,396 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +LIBOBJDIR = +subdir = unix +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +AR = ar +ARFLAGS = cru +libunix_a_AR = $(AR) $(ARFLAGS) +libunix_a_LIBADD = +am_libunix_a_OBJECTS = arlib.$(OBJEXT) dcache.$(OBJEXT) \ + dirbrk.$(OBJEXT) rmprq.$(OBJEXT) ruletab.$(OBJEXT) \ + runargv.$(OBJEXT) tempnam.$(OBJEXT) +libunix_a_OBJECTS = $(am_libunix_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libunix_a_SOURCES) +DIST_SOURCES = $(libunix_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DBUG_FALSE = @DBUG_FALSE@ +DBUG_TRUE = @DBUG_TRUE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DMAKEROOT_H_LINE1 = @DMAKEROOT_H_LINE1@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +OS_LIBRARY = @OS_LIBRARY@ +OS_SUBDIRS = @OS_SUBDIRS@ +OS_TYPE = @OS_TYPE@ +OS_VERSION = @OS_VERSION@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_LIBRARIES = libunix.a +libunix_a_SOURCES = arlib.c dcache.c dirbrk.c rmprq.c ruletab.c runargv.c tempnam.c +INCLUDES = -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/unix/@OS_VERSION@/gnu -I$(top_srcdir)/unix -I$(top_srcdir)/unix/@OS_VERSION@ +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign unix/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign unix/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libunix.a: $(libunix_a_OBJECTS) $(libunix_a_DEPENDENCIES) + -rm -f libunix.a + $(libunix_a_AR) libunix.a $(libunix_a_OBJECTS) $(libunix_a_LIBADD) + $(RANLIB) libunix.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dcache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dirbrk.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmprq.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ruletab.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runargv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tempnam.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dmake/unix/arlib.c b/dmake/unix/arlib.c new file mode 100644 index 000000000000..3a667f08188f --- /dev/null +++ b/dmake/unix/arlib.c @@ -0,0 +1,610 @@ +/* $RCSfile: arlib.c,v $ +-- $Revision: 1.5 $ +-- last change: $Author: hr $ $Date: 2006-04-20 12:18:37 $ +-- +-- SYNOPSIS +-- Unix archive manipulation code. +-- +-- DESCRIPTION +-- Originally this code was provided by Eric Gisin of MKS. I took +-- his code and completely rewrote it adding cacheing of lib members +-- and other various optimizations. I kept the overal functional +-- idea of the library routines as they are similar to those in GNU +-- make and felt it advantageous to maintain a similar interface. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/* Sun unix on 386i's has a broken ar.h that does not assume PORTAR format + * by default, so we fix it here. */ +#if defined(i386) || defined(__DGUX__) +#define PORTAR 1 +#endif + +#if !defined (COHERENT) && !defined(__COHERENT__) +#include <ar.h> +#else +#include <arcoff.h> +#endif /* COHERENT, __COHERENT__ */ +#include "extern.h" +#include "sysintf.h" + +/* By defining the defines below it is possible to configure the library + * code for library cacheing/non-cacheing, ASCII archive headers, and a full + * decode of the ar_hdr fields in the scan_ar function. */ + +#ifndef ASCARCH +#define ASCARCH 1 /* ASCII time stored in archive */ +#endif + +#ifndef LC +#define LC 1 /* Turn on library cacheing */ +#endif + +#ifndef CHECKELF +#define CHECKELF 1 /* Enable Elf long member names */ +#endif + +#ifndef DECODE_ALL_AR_FIELDS +#define DECODE_ALL_AR_FIELDS 0 /* decode only fields make needs*/ +#endif + +#ifndef AR_TRUNCATE_MEMBER_NAMES +#define AR_TRUNCATE_MEMBER_NAMES 0 /* truncate member names for */ +#endif /* comparison. */ + +#if LC +# define FOUND_MEMBER FALSE +#else +# define FOUND_MEMBER TRUE +# define _cache_member(a, b, c) +# define _check_cache(a, b, c, d) FALSE +#endif + +#define MAXFNAME 255 /* Max length of member name */ +#define MAXMNAME 8 /* Max module name < MAXFNAME */ + + +/* This struct is used to pass the library and member inrmation about the + * routines that perform the library seeking/cacheing */ +struct ar_args { + char *lib; + char *member; + time_t time; +}; + + +typedef struct AR { + char ar_name[MAXFNAME+1]; /* File name */ + long ar_size; /* Size in bytes */ + time_t ar_time; /* Modification time */ + +#ifdef DOS + char ar_modname[MAXMNAME+1]; /* DOS module name */ +#endif + +#if DECODE_ALL_AR_FIELDS + uint16 ar_mode; /* File mode */ + uint16 ar_uid; /* File owner */ + uint16 ar_gid; /* File group owner */ +#endif +} AR, *ARPTR; + + +static int ar_scan ANSI((FILE *, + int (*) ANSI((FILE *, struct AR *,struct ar_args *)), + struct ar_args *)); +static int ar_touch ANSI(( FILE *, time_t )); +static int time_function ANSI(( FILE *, struct AR *, struct ar_args * )); +static int touch_function ANSI(( FILE *, struct AR *, struct ar_args * )); +static int ar_name_equal ANSI((char *, char *)); + +#if LC +static int _cache_member ANSI((char *, char *, time_t)); +static int _check_cache ANSI((char *, char *, time_t *, int)); +#endif + +/* decoded archive header */ +static AR _ar; +static off_t arhdroffset; /* member seek offset */ + + +PUBLIC time_t +seek_arch(name, lib)/* +====================== + Look for module 'name' inside 'lib'. If compiled with cacheing then first + check to see if the specified lib is cached. If so then return that time + stamp instead of looking into the library. */ +char *name; +char *lib; +{ + FILE *f; + int rv; + time_t mtime; + struct ar_args args; + + /* Check the cache first (if there is a cache) */ + if( _check_cache(name, lib, &mtime, FALSE) ) return( mtime ); + + /* Open the lib file and perform the scan of the members, looking + * for our particular member. If cacheing is enabled it will be + * taken care of automatically during the scan. */ + + args.lib = lib; + args.member = name; + args.time = (time_t)0L; + + if( (f = fopen(lib, "r")) == NIL(FILE) ) return( (time_t)0L ); + rv = ar_scan(f, time_function, &args ); + fclose( f ); + + if( rv < 0 ) Fatal("(%s): Invalid library format", lib); + + return( args.time ); +} + + +PUBLIC int +touch_arch(name, lib)/* +======================= + Look for module 'name' inside 'lib'. If compiled with cacheing then first + check to see if the specified lib is cached. If so then set that time + stamp and write it into the library. Returns 0 on success, non-zero + on failure. */ +char *name; +char *lib; +{ + FILE *f; + int rv; + struct ar_args args; + + /* Open the lib file and perform the scan of the members, looking + * for our particular member. If cacheing is enabled it will be + * taken care of automatically during the scan. */ + + args.lib = lib; + args.member = name; + args.time = (time_t)0L; + + if( (f = fopen(lib, "r+")) == NIL(FILE) ) return( (time_t)1L ); + rv = ar_scan(f, touch_function, &args ); + fclose( f ); + + if( rv < 0 ) Fatal("(%s): Invalid library format", lib); + + return( 0 ); +} + + + +static int +time_function(f, arp, argp)/* +============================= + get library member's time, if it matches than return it in argp, if + cacheing is enabled than cache the library members also. */ +FILE *f; /* library file */ +struct AR *arp; /* library member header */ +struct ar_args *argp; +{ + int rv = _cache_member( arp->ar_name, argp->lib, arp->ar_time ); + + if( ar_name_equal (argp->member, arp->ar_name)) { + argp->time = arp->ar_time; + + if( arp->ar_time == 0 && !(Glob_attr & A_SILENT) ) + Warning( "(%s): Can't extract library member timestamp; using EPOCH", + argp->member); + + return( rv ); /* 1 => no cacheing, 0 => cacheing */ + } + + return( FALSE ); /* continue scan */ +} + + + +static int +touch_function(f, arp, argp)/* +============================== + Update library member's time stamp, and write new time value into cache + if required. */ +FILE *f; /* library file */ +struct AR *arp; /* library member header */ +struct ar_args *argp; +{ + extern time_t time ANSI(( time_t * )); + time_t now = time((time_t*) NULL); /* Current time. */ + + if( ar_name_equal(argp->member, arp->ar_name) ) { + _check_cache( argp->member, argp->lib, &now, TRUE ); + ar_touch(f, now ); + + return( TRUE ); + } + + return( FALSE ); /* continue scan */ +} + + +static int +ar_name_equal (char * name1, char * name2) +{ + int equal; + +#if AR_TRUNCATE_MEMBER_NAMES + struct ar_hdr hdr; + + equal = !strncmp (name1, name2, sizeof (hdr.ar_name)-1); +#else + equal = !strcmp (name1, name2); +#endif + + return equal; +} + + +static int +ar_scan(f, function, arg)/* +=========================== + Scan the opened archive, and call the given function for each member found. + The function will be called with the file positioned at the beginning of + the member and it can read up to arp->ar_size bytes of the archive member. + If the function returns 1, we stop and return 1. We return 0 at the end + of the archive, or -1 if the archive has invalid format. This interface + is more general than required by "make", but it can be used by other + utilities. */ +register FILE *f; +int (*function) ANSI((FILE *, struct AR *, struct ar_args *)); +struct ar_args *arg; +{ + extern long atol (); + register char *p; + struct ar_hdr arhdr; /* archive member header */ + long nsize; /* size of member name */ + long arind=0; /* archive index offset */ + int process; +#if defined(_AIX) + struct fl_hdr flhdr; /* archive file header */ + char magic[SAIAMAG]; /* size of magic string */ +#else +#if ASCARCH + char magic[SARMAG]; +#else + unsigned short word; +#endif +#endif + + fseek( f, 0L, 0 ); /* Start at the beginning of the archive file */ + +#if ASCARCH +#if defined(_AIX) + fread( (char *)&flhdr, sizeof(flhdr), 1, f ); + if( strncmp(flhdr.fl_magic,AIAMAG, SAIAMAG) != 0 ) return(-1); + fseek(f, atol(flhdr.fl_fstmoff), 0 ); /* postition to first member */ +#else + fread( magic, sizeof(magic), 1, f ); + if( strncmp(magic, ARMAG, SARMAG) != 0 ) return( -1 ); +#endif +#else + fread( (char*)&word, sizeof(word), 1, f ); + if( word != ARMAG ) return( -1 ); +#endif + + /* scan the library, calling `function' for each member + */ + while( 1 ) { + arhdroffset = ftell(f); +#if defined(_AIX) + if( fread((char*)&arhdr,sizeof(arhdr)-sizeof(arhdr._ar_name),1,f)!=1) + break; + nsize = atoi(arhdr.ar_namlen); + fseek(f, arhdroffset+(unsigned long)(((struct ar_hdr *)0)->_ar_name.ar_name), 0); + if( fread((char*)_ar.ar_name,nsize,1,f)!=1) + break; + _ar.ar_name[nsize]='\0'; +#else + if( fread((char*) &arhdr, sizeof(arhdr), 1, f) != 1 ) break; + strncpy(_ar.ar_name, arhdr.ar_name, nsize = sizeof(arhdr.ar_name)); +#endif + + for( p = &_ar.ar_name[nsize]; + --p >= _ar.ar_name && *p == ' ';); + + p[1] = '\0'; + if( *p == '/' ) *p = 0; /* SysV has trailing '/' */ + + /* check to see if this is an archive index using SsysV Index scheme. + * see ar(4) man page for more info */ +#if CHECKELF + if( _ar.ar_name[0] == '/' && _ar.ar_name[1] == '\0' ) { + arind = arhdroffset+sizeof(arhdr); + process = 0; + } + else +#endif + process = 1; + +#if !defined(_AIX) +#if ASCARCH + if( strncmp(arhdr.ar_fmag, ARFMAG, sizeof(arhdr.ar_fmag)) != 0 ) + return( -1 ); + _ar.ar_time = atol(arhdr.ar_date); + _ar.ar_size = atol(arhdr.ar_size); +#else + _ar.ar_time = arhdr.ar_date; + _ar.ar_size = arhdr.ar_size; +#endif +#if CHECKELF + /* check for names of the form /xxxx where xxxx is an offset into the + * name table pointed at by arind. */ + if(arind && _ar.ar_name[0] == '/') { + long offset = atol(_ar.ar_name+1); + long here = ftell(f); + int c; + + fseek(f, arind+offset, 0); + p = _ar.ar_name; + while((c=fgetc(f)) != EOF) { + *p++ = c; + if(c == '/') { + p[-1] = '\0'; + break; + } + } + + if (c==EOF) return(-1); /* 'c' should never be EOF */ + fseek(f, here, 0); + } +#endif +#else +#if ASCARCH + _ar.ar_time = atol(arhdr.ar_date); + _ar.ar_size = atol(arhdr.ar_nxtmem); +#else + _ar.ar_time = arhdr.ar_date; + _ar.ar_size = arhdr.ar_nxtmem; +#endif +#endif + + +#if DECODE_ALL_AR_FIELDS +#if ASCARCH + _ar.ar_mode = atoi(arhdr.ar_mode); + _ar.ar_uid = atoi(arhdr.ar_uid); + _ar.ar_gid = atoi(arhdr.ar_gid); +#else + _ar.ar_mode = arhdr.ar_mode; + _ar.ar_uid = arhdr.ar_uid; + _ar.ar_gid = arhdr.ar_gid; +#endif +#endif + if( process && (*function)(f, &_ar, arg) ) return( 1 ); + +#if defined(_AIX) + if( _ar.ar_size == 0L ) break; + fseek( f, (long) _ar.ar_size, 0 ); +#else + fseek( f, arhdroffset + sizeof(arhdr) + ((_ar.ar_size+1) & ~1L), 0 ); +#endif + } + +#if !defined(_AIX) + if( !feof(f) ) return( -1 ); +#endif + return 0; +} + + + +static int +ar_touch( f, now )/* +==================== + touch module header timestamp. */ +FILE *f; +time_t now; +{ + + fseek(f, arhdroffset + (unsigned long)(((struct ar_hdr *)0)->ar_date), 0); + +#if ASCARCH + fprintf(f, "%lu", now); +#else + fwrite((char *)now, sizeof(now), 1, f); +#endif + + return( ferror(f) ? 0 : 1 ); +} + + +#if LC +typedef struct mem { + time_t m_time; /* modify time of member*/ + struct mem *m_next; /* next member in lib */ + char m_valid; /* valid cache entry */ + char m_name[1]; /* lib member name */ +} MEM, *MEMPTR; + +typedef struct lib { + struct lib *lb_next; /* next library in list */ + struct mem *lb_members; /* list of lib members */ + char lb_valid; /* valid cache entry */ + char *lb_name; /* library name */ +} LIB, *LIBPTR; + +static LIBPTR _cache = NIL(LIB); +static MEMPTR _find_member ANSI(( LIBPTR, char * )); + +static int +_check_cache( name, lib, pmtime, touch )/* +========================================== + Check to see if we have cached member in lib, if so return time in pmtime + and return TRUE, otherwise return FALSE, if touch is TRUE then touch + the archive member instead. */ +char *name; +char *lib; +time_t *pmtime; +int touch; +{ + register MEMPTR mp; + register LIBPTR lp; + + for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next ); + if( lp == NIL(LIB) ) return( FALSE ); + + mp = _find_member( lp, name ); + if( mp == NIL(MEM) || !mp->m_valid ) return( FALSE ); + + if( touch == TRUE ) + { + mp->m_time = *pmtime; + mp->m_valid = 1; + } + else + *pmtime = mp->m_time; + + lp->lb_valid = 1; + lp->lb_members = mp; + + return( TRUE ); +} + + + +static int +_cache_member( name, lib, mtime )/* +=================================== + Cache name in lib along with it's time */ +char *name; +char *lib; +time_t mtime; +{ + register MEMPTR mp; + register LIBPTR lp; + + for( lp=_cache; + lp != NIL(LIB) && lp->lb_name != NIL(char) && lp->lb_name != lib; + lp=lp->lb_next); + + if( lp == NIL(LIB) ) + { + lp = (LIBPTR) malloc(sizeof(LIB)); + if( lp == NIL(LIB) ) No_ram(); + + lp->lb_name = lib; + lp->lb_members = NIL(MEM); + lp->lb_next = _cache; + lp->lb_valid = 0; + _cache = lp; + } + + /* On UNIX ar does not allow multiple copies of the same .o file to live + * in the same AR file. If this is not TRUE then use the commented out + * version to set the value of mp. */ + + /*mp = _find_member(lp, name);*/ + mp = NIL(MEM); + + if( mp == NIL(MEM) ) + { + mp = (MEMPTR) malloc(sizeof(char)*offsetof(MEM,m_name[strlen(name)+1])); + if( mp == NIL(MEM) ) No_ram(); + + strcpy( mp->m_name, name ); + mp->m_time = mtime; + + if( lp->lb_members == NIL(MEM) ) { + mp->m_next = mp; + lp->lb_members = mp; + } + else { + mp->m_next = lp->lb_members->m_next; + lp->lb_members->m_next = mp; + lp->lb_members = mp; + } + } + else + mp->m_time = mtime; + + mp->m_valid = 1; + + return( lp->lb_valid ); +} + + +static MEMPTR +_find_member( lp, name ) +LIBPTR lp; +char *name; +{ + register MEMPTR mp = lp->lb_members; + + if( mp == NIL(MEM) ) return(mp); + + do { + if( !strcmp(mp->m_name, name ) ) return( mp ); + mp = mp->m_next; + } + while( mp != lp->lb_members ); + + return( NIL(MEM) ); +} +#endif + + + +PUBLIC void +void_lcache( lib, member )/* +============================ + Void the library cache for lib. If member is NIL(char) then nuke all + of the members, if member is NOT NIL(char) then invalidate only that + member. */ +char *lib; +char *member; +{ +#if LC + register LIBPTR lp; + register MEMPTR mp; + register MEMPTR tmp; + + for( lp=_cache; lp != NIL(LIB) && lp->lb_name != lib; lp=lp->lb_next ); + if( lp == NIL(LIB) ) return; + + if( member == NIL(char) ) { + mp = lp->lb_members; + do { + tmp = mp->m_next; + (void) free( mp ); + mp = tmp; + } while( mp != lp->lb_members ); + + lp->lb_valid = 0; + lp->lb_members = NIL(MEM); + lp->lb_name = NIL(char); + } + else { + mp=lp->lb_members; + do { + if( strcmp( member, mp->m_name) == 0 ) { + lp->lb_members = mp->m_next; + mp->m_valid = 0; + } + + mp=mp->m_next; + } while( mp != lp->lb_members ); + } +#endif +} diff --git a/dmake/unix/bsd43/config.mk b/dmake/unix/bsd43/config.mk new file mode 100644 index 000000000000..e99937342e68 --- /dev/null +++ b/dmake/unix/bsd43/config.mk @@ -0,0 +1,27 @@ +# This is the BSD 4.3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following sources are required for BSD4.3 +OSDSRC := putenv.c tempnam.c utime.c setvbuf.c +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local BSD includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/bsd43/dirent.h b/dmake/unix/bsd43/dirent.h new file mode 100644 index 000000000000..82f910ed3a7d --- /dev/null +++ b/dmake/unix/bsd43/dirent.h @@ -0,0 +1,28 @@ +/* RCS $Id: dirent.h,v 1.1.1.1 2000-09-22 15:33:33 hr Exp $ +-- +-- SYNOPSIS +-- dirent +-- +-- DESCRIPTION +-- Deal with sysV'ish dirent.h on BSD4.3 systems, which have the stuff +-- in sys/dir.h +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <sys/dir.h> +#define dirent direct diff --git a/dmake/unix/bsd43/limits.h b/dmake/unix/bsd43/limits.h new file mode 100644 index 000000000000..a08805d00d66 --- /dev/null +++ b/dmake/unix/bsd43/limits.h @@ -0,0 +1,32 @@ +/* RCS $Id: limits.h,v 1.1.1.1 2000-09-22 15:33:33 hr Exp $ +-- +-- SYNOPSIS +-- limits +-- +-- DESCRIPTION +-- Compensate for systems that don't have a limits.h header file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <sys/types.h> +#include <sys/dirent.h> +#include <sys/param.h> + +#define NAME_MAX MAXNAMLEN +#define PATH_MAX MAXPATHLEN +#define CHILD_MAX 20 diff --git a/dmake/unix/bsd43/make.sh b/dmake/unix/bsd43/make.sh new file mode 100644 index 000000000000..e45d01952f46 --- /dev/null +++ b/dmake/unix/bsd43/make.sh @@ -0,0 +1,69 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/bsd43 -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/putenv.c +mv putenv.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/tempnam.c +mv tempnam.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/utime.c +mv utime.o objects +cc -c -I. -Iunix -Iunix/bsd43 -O unix/bsd43/setvbuf.c +mv setvbuf.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o \ +objects/dcache.o objects/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o +cp unix/bsd43/template.mk startup/config.mk diff --git a/dmake/unix/bsd43/public.h b/dmake/unix/bsd43/public.h new file mode 100644 index 000000000000..1a08478125b6 --- /dev/null +++ b/dmake/unix/bsd43/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:54:02 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/bsd43/putenv.c b/dmake/unix/bsd43/putenv.c new file mode 100644 index 000000000000..d0ed998158e0 --- /dev/null +++ b/dmake/unix/bsd43/putenv.c @@ -0,0 +1,78 @@ +/* RCS $Id: putenv.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- My own putenv for BSD like systems. +-- +-- DESCRIPTION +-- This originally came from MKS, but I rewrote it to fix a bug with +-- replacing existing strings, probably never happened but the code +-- was wrong nonetheless. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <stdio.h> +#include <string.h> + +int +putenv( str )/* +=============== + Take a string of the form NAME=value and stick it into the environment. + We do this by allocating a new set of pointers if we have to add a new + string and by replacing an existing pointer if the value replaces the value + of an existing string. */ +char *str; +{ + extern char **environ; /* The current environment. */ + static char **ourenv = NULL; /* A new environment */ + register char **p; + register char *q; + int size; + + /* First search the current environment and see if we can replace a + * string. */ + for( p=environ; *p; p++ ) { + register char *s = str; + + for( q = *p; *q && *s && *s == *q; q++, s++ ) + if( *s == '=' ) { + *p = str; + return(0); /* replaced it so go away */ + } + } + + /* Ok, can't replace a string so need to grow the environment. */ + size = p - environ + 2; /* size of new environment */ + /* size of old is size-1 */ + + /* It's the first time, so allocate a new environment since we don't know + * where the old one is comming from. */ + if( ourenv == NULL ) { + if( (ourenv = (char **) malloc( sizeof(char *)*size )) == NULL ) + return(1); + + memcpy( (char *)ourenv, (char *)environ, (size-2)*sizeof(char *) ); + } + else if( (ourenv = (char **)realloc( ourenv, size*sizeof(char *))) == NULL ) + return(1); + + ourenv[--size] = NULL; + ourenv[--size] = str; + + environ = ourenv; + return(0); +} diff --git a/dmake/unix/bsd43/setvbuf.c b/dmake/unix/bsd43/setvbuf.c new file mode 100644 index 000000000000..ce5d193fbe89 --- /dev/null +++ b/dmake/unix/bsd43/setvbuf.c @@ -0,0 +1,40 @@ +/* RCS $Id: setvbuf.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- Setvbuf for BSD +-- +-- DESCRIPTION +-- A sysv call, standard BSD doesn't have this. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <stdio.h> + +setvbuf(fp, bp, type, len_unused) +FILE* fp; +char* bp; +int type; +int len_unused; +{ + switch (type) { + case _IOLBF: setlinebuf(fp); return; + case _IONBF: setbuf(fp, NULL); return; + default: setbuf(fp, bp); return; + } +} + diff --git a/dmake/unix/bsd43/stdlib.h b/dmake/unix/bsd43/stdlib.h new file mode 100644 index 000000000000..82ab9627cd65 --- /dev/null +++ b/dmake/unix/bsd43/stdlib.h @@ -0,0 +1,44 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); +extern free(); +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/bsd43/string.h b/dmake/unix/bsd43/string.h new file mode 100644 index 000000000000..862c17960a0b --- /dev/null +++ b/dmake/unix/bsd43/string.h @@ -0,0 +1,43 @@ +/* RCS $Id: string.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- string function headers +-- +-- DESCRIPTION +-- Supply correct definitions for certain string functions. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ +#ifndef STRING_h +#define STRING_h + +/* +** BSD does this wrong +*/ +#include <strings.h> + +#include "stdmacs.h" +extern char* strpbrk ANSI((char* src, char* any)); + +#ifndef DBUG +#define strchr(str,c) index(str,c) +#define strrchr(str,c) rindex(str,c) +#else +char *strchr ANSI((char*, char)); +char *strrchr ANSI((char*, char)); +#endif +#endif diff --git a/dmake/unix/bsd43/template.mk b/dmake/unix/bsd43/template.mk new file mode 100644 index 000000000000..14a7cab8ed4b --- /dev/null +++ b/dmake/unix/bsd43/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= bsd43 + OSENVIRONMENT *:= diff --git a/dmake/unix/bsd43/tempnam.c b/dmake/unix/bsd43/tempnam.c new file mode 100644 index 000000000000..12512ec9cb8b --- /dev/null +++ b/dmake/unix/bsd43/tempnam.c @@ -0,0 +1,103 @@ +/* RCS $Id: tempnam.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- tempnam +-- +-- DESCRIPTION +-- temp file name generation routines. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/*LINTLIBRARY*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define max(A,B) (((A)<(B))?(B):(A)) + +extern char *mktemp(); +extern int access(); + +static char *cpdir(); +static char seed[4]="AAA"; + +/* BSD stdio.h doesn't define P_tmpdir, so let's do it here */ +#ifndef P_tmpdir +static char *P_tmpdir = "/tmp"; +#endif + +char * +tempnam(dir, prefix) +char *dir; /* use this directory please (if non-NULL) */ +char *prefix; /* use this (if non-NULL) as filename prefix */ +{ + register char *p, *q, *tmpdir; + int tl=0, dl=0, pl; + + pl = strlen(P_tmpdir); + + if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir); + if( dir != NULL ) dl = strlen(dir); + + if( (p = malloc((unsigned)(max(max(dl,tl),pl)+16))) == NULL ) + return(NULL); + + *p = '\0'; + + if( (tl == 0) || (access( cpdir(p, tmpdir), 3) != 0) ) + if( (dl == 0) || (access( cpdir(p, dir), 3) != 0) ) + if( access( cpdir(p, P_tmpdir), 3) != 0 ) + if( access( cpdir(p, "/tmp"), 3) != 0 ) + return(NULL); + + (void) strcat(p, "/"); + if(prefix) + { + *(p+strlen(p)+5) = '\0'; + (void)strncat(p, prefix, 5); + } + + (void)strcat(p, seed); + (void)strcat(p, "XXXXXX"); + + q = seed; + while(*q == 'Z') *q++ = 'A'; + ++*q; + + if(*mktemp(p) == '\0') return(NULL); + return(p); +} + + + +static char * +cpdir(buf, str) +char *buf; +char *str; +{ + char *p; + + if(str != NULL) + { + (void) strcpy(buf, str); + p = buf - 1 + strlen(buf); + if(*p == '/') *p = '\0'; + } + + return(buf); +} diff --git a/dmake/unix/bsd43/utime.c b/dmake/unix/bsd43/utime.c new file mode 100644 index 000000000000..9d26700d8006 --- /dev/null +++ b/dmake/unix/bsd43/utime.c @@ -0,0 +1,70 @@ +/* RCS $Id: utime.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- utime +-- +-- DESCRIPTION +-- Provide our own utime function. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <sys/types.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <sys/file.h> + +int +utime(name, timep) +char* name; +time_t timep[2]; +{ + struct timeval tv[2], *tvp; + struct stat buf; + int fil; + char data; + + if (timep!=0) + { + tvp = tv, tv[0].tv_sec = timep[0], tv[1].tv_sec = timep[1]; + if (utimes(name, tvp)==0) + return (0); + } + + if (stat(name, &buf) != 0) + return (-1); + if (buf.st_size != 0) { + if ((fil = open(name, O_RDWR, 0666)) < 0) + return (-1); + if (read(fil, &data, 1) < 1) { + close(fil); + return (-1); + } + lseek(fil, 0L, 0); + if (write(fil, &data, 1) < 1) { + close(fil); + return (-1); + } + close(fil); + return (0); + } else if ((fil = creat(name, 0666)) < 0) { + return (-1); + } else { + close(fil); + return (0); + } +} diff --git a/dmake/unix/bsd43/uw/config.mk b/dmake/unix/bsd43/uw/config.mk new file mode 100644 index 000000000000..1f94136f6d6e --- /dev/null +++ b/dmake/unix/bsd43/uw/config.mk @@ -0,0 +1,17 @@ +# This is the BSD 4.3 University of Waterloo (uw) UNIX configuration file +# for DMAKE +# It simply modifies the values of LDLIBS to include libuw.a +# so that vfprintf can be found. +# + +LDLIBS += -luw +osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT) +CFLAGS += -I$(osredir) + +# install script for UW's /usr/software hierarchy... +install: + mkdir ../bin; strip ./dmake; mv ./dmake ../bin + chmod a+rx ../bin/dmake ../bin + mkdir ../lib; chmod a+rx ../lib + cp $(STARTUPFILE) ../lib + chmod a+r ../lib/startup.mk diff --git a/dmake/unix/bsd43/uw/make.sh b/dmake/unix/bsd43/uw/make.sh new file mode 100644 index 000000000000..f23ecbb8ec44 --- /dev/null +++ b/dmake/unix/bsd43/uw/make.sh @@ -0,0 +1,69 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/putenv.c +mv putenv.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/tempnam.c +mv tempnam.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/utime.c +mv utime.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/uw -O unix/bsd43/setvbuf.c +mv setvbuf.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o \ +objects/dcache.o objects/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o -luw +cp unix/bsd43/uw/template.mk startup/config.mk diff --git a/dmake/unix/bsd43/uw/public.h b/dmake/unix/bsd43/uw/public.h new file mode 100644 index 000000000000..fe2709c60023 --- /dev/null +++ b/dmake/unix/bsd43/uw/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:54:14 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/bsd43/uw/template.mk b/dmake/unix/bsd43/uw/template.mk new file mode 100644 index 000000000000..6afe91c1fc7a --- /dev/null +++ b/dmake/unix/bsd43/uw/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= bsd43 + OSENVIRONMENT *:= uw diff --git a/dmake/unix/bsd43/vf/config.mk b/dmake/unix/bsd43/vf/config.mk new file mode 100644 index 000000000000..bf4e64808d6c --- /dev/null +++ b/dmake/unix/bsd43/vf/config.mk @@ -0,0 +1,11 @@ +# This config file adds vfprintf.c and memcpy.c for those systems that +# do not have it. +# + +osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT) +CFLAGS += -I$(osredir) + +# The following sources are required for BSD4.3 +OSDESRC := memcpy.c vfprintf.c +SRC += $(OSDESRC) +.SETDIR=$(osredir) : $(OSDESRC) diff --git a/dmake/unix/bsd43/vf/ctype.h b/dmake/unix/bsd43/vf/ctype.h new file mode 100644 index 000000000000..f229a9ab3967 --- /dev/null +++ b/dmake/unix/bsd43/vf/ctype.h @@ -0,0 +1,51 @@ +/* RCS $Id: ctype.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- ctype +-- +-- DESCRIPTION +-- ctype.h 4.2 85/09/04 +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 + +extern char _ctype_[]; + +#define isalpha(c) ((_ctype_+1)[c]&(_U|_L)) +#define isupper(c) ((_ctype_+1)[c]&_U) +#define islower(c) ((_ctype_+1)[c]&_L) +#define isdigit(c) ((_ctype_+1)[c]&_N) +#define isxdigit(c) ((_ctype_+1)[c]&(_N|_X)) +#define isspace(c) ((_ctype_+1)[c]&_S) +#define ispunct(c) ((_ctype_+1)[c]&_P) +#define isalnum(c) ((_ctype_+1)[c]&(_U|_L|_N)) +#define isprint(c) ((_ctype_+1)[c]&(_P|_U|_L|_N|_B)) +#define isgraph(c) ((_ctype_+1)[c]&(_P|_U|_L|_N)) +#define iscntrl(c) ((_ctype_+1)[c]&_C) +#define isascii(c) ((unsigned)(c)<=0177) +#define toupper(c) ((c)-'a'+'A') +#define tolower(c) ((c)-'A'+'a') +#define toascii(c) ((c)&0177) diff --git a/dmake/unix/bsd43/vf/make.sh b/dmake/unix/bsd43/vf/make.sh new file mode 100644 index 000000000000..231b683a80e6 --- /dev/null +++ b/dmake/unix/bsd43/vf/make.sh @@ -0,0 +1,73 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/putenv.c +mv putenv.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/tempnam.c +mv tempnam.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/utime.c +mv utime.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/setvbuf.c +mv setvbuf.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/vf/memcpy.c +mv memcpy.o objects +cc -c -I. -Iunix -Iunix/bsd43 -Iunix/bsd43/vf -O unix/bsd43/vf/vfprintf.c +mv vfprintf.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o \ +objects/dcache.o objects/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o objects/memcpy.o objects/vfprintf.o +cp unix/bsd43/vf/template.mk startup/config.mk diff --git a/dmake/unix/bsd43/vf/memcpy.c b/dmake/unix/bsd43/vf/memcpy.c new file mode 100644 index 000000000000..4ae47722e851 --- /dev/null +++ b/dmake/unix/bsd43/vf/memcpy.c @@ -0,0 +1,36 @@ +/* RCS $Id: memcpy.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- memcpy +-- +-- DESCRIPTION +-- BSD didn't have this in the library many moons ago. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +char * +memcpy(t, f, n) +register char *t, *f; +register n; +{ + register char *p = t; + + while( --n >= 0 ) *t++ = *f++; + + return (p); +} diff --git a/dmake/unix/bsd43/vf/public.h b/dmake/unix/bsd43/vf/public.h new file mode 100644 index 000000000000..4483a04fe534 --- /dev/null +++ b/dmake/unix/bsd43/vf/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:54:25 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/bsd43/vf/template.mk b/dmake/unix/bsd43/vf/template.mk new file mode 100644 index 000000000000..395cd4718fa0 --- /dev/null +++ b/dmake/unix/bsd43/vf/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= bsd43 + OSENVIRONMENT *:= vf diff --git a/dmake/unix/bsd43/vf/vfprintf.c b/dmake/unix/bsd43/vf/vfprintf.c new file mode 100644 index 000000000000..675e2e83e5ab --- /dev/null +++ b/dmake/unix/bsd43/vf/vfprintf.c @@ -0,0 +1,48 @@ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)vfprintf.c 5.2 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ + +#include <stdio.h> +#include <varargs.h> + +int +vfprintf(iop, fmt, ap) + FILE *iop; + char *fmt; + va_list ap; +{ + int len; + char localbuf[BUFSIZ]; + + if (iop->_flag & _IONBF) { + iop->_flag &= ~_IONBF; + iop->_ptr = iop->_base = localbuf; + len = _doprnt(fmt, ap, iop); + (void) fflush(iop); + iop->_flag |= _IONBF; + iop->_base = NULL; + iop->_bufsiz = 0; + iop->_cnt = 0; + } else + len = _doprnt(fmt, ap, iop); + + return (ferror(iop) ? EOF : len); +} + diff --git a/dmake/unix/bsdarm32/config.mk b/dmake/unix/bsdarm32/config.mk new file mode 100644 index 000000000000..e99937342e68 --- /dev/null +++ b/dmake/unix/bsdarm32/config.mk @@ -0,0 +1,27 @@ +# This is the BSD 4.3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following sources are required for BSD4.3 +OSDSRC := putenv.c tempnam.c utime.c setvbuf.c +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local BSD includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/bsdarm32/dirent.h b/dmake/unix/bsdarm32/dirent.h new file mode 100644 index 000000000000..b50fa18a9d9e --- /dev/null +++ b/dmake/unix/bsdarm32/dirent.h @@ -0,0 +1,30 @@ +/* RCS $Id: dirent.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- dirent +-- +-- DESCRIPTION +-- Deal with sysV'ish dirent.h on BSD4.3 systems, which have the stuff +-- in sys/dir.h +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <sys/dir.h> +#include </usr/include/dirent.h> +#define dirent direct + diff --git a/dmake/unix/bsdarm32/limits.h b/dmake/unix/bsdarm32/limits.h new file mode 100644 index 000000000000..655d707bb4f6 --- /dev/null +++ b/dmake/unix/bsdarm32/limits.h @@ -0,0 +1,29 @@ +/* RCS $Id: limits.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- limits +-- +-- DESCRIPTION +-- Compensate for systems that don't have a limits.h header file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <sys/types.h> +#include <sys/dirent.h> +#include <sys/param.h> + diff --git a/dmake/unix/bsdarm32/make.sh b/dmake/unix/bsdarm32/make.sh new file mode 100644 index 000000000000..f43dd9425774 --- /dev/null +++ b/dmake/unix/bsdarm32/make.sh @@ -0,0 +1,67 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/bsdarm32/putenv.c +mv putenv.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/bsdarm32/tempnam.c +mv tempnam.o objects +cc -c -I. -Iunix -Iunix/bsdarm32 -O unix/bsdarm32/utime.c +mv utime.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o \ +objects/dcache.o objects/putenv.o objects/tempnam.o objects/utime.o objects/setvbuf.o +cp unix/bsdarm32/template.mk startup/config.mk diff --git a/dmake/unix/bsdarm32/public.h b/dmake/unix/bsdarm32/public.h new file mode 100644 index 000000000000..f06831cdc264 --- /dev/null +++ b/dmake/unix/bsdarm32/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:54:38 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/bsdarm32/putenv.c b/dmake/unix/bsdarm32/putenv.c new file mode 100644 index 000000000000..d0ed998158e0 --- /dev/null +++ b/dmake/unix/bsdarm32/putenv.c @@ -0,0 +1,78 @@ +/* RCS $Id: putenv.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- My own putenv for BSD like systems. +-- +-- DESCRIPTION +-- This originally came from MKS, but I rewrote it to fix a bug with +-- replacing existing strings, probably never happened but the code +-- was wrong nonetheless. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <stdio.h> +#include <string.h> + +int +putenv( str )/* +=============== + Take a string of the form NAME=value and stick it into the environment. + We do this by allocating a new set of pointers if we have to add a new + string and by replacing an existing pointer if the value replaces the value + of an existing string. */ +char *str; +{ + extern char **environ; /* The current environment. */ + static char **ourenv = NULL; /* A new environment */ + register char **p; + register char *q; + int size; + + /* First search the current environment and see if we can replace a + * string. */ + for( p=environ; *p; p++ ) { + register char *s = str; + + for( q = *p; *q && *s && *s == *q; q++, s++ ) + if( *s == '=' ) { + *p = str; + return(0); /* replaced it so go away */ + } + } + + /* Ok, can't replace a string so need to grow the environment. */ + size = p - environ + 2; /* size of new environment */ + /* size of old is size-1 */ + + /* It's the first time, so allocate a new environment since we don't know + * where the old one is comming from. */ + if( ourenv == NULL ) { + if( (ourenv = (char **) malloc( sizeof(char *)*size )) == NULL ) + return(1); + + memcpy( (char *)ourenv, (char *)environ, (size-2)*sizeof(char *) ); + } + else if( (ourenv = (char **)realloc( ourenv, size*sizeof(char *))) == NULL ) + return(1); + + ourenv[--size] = NULL; + ourenv[--size] = str; + + environ = ourenv; + return(0); +} diff --git a/dmake/unix/bsdarm32/stdlib.h b/dmake/unix/bsdarm32/stdlib.h new file mode 100644 index 000000000000..82ab9627cd65 --- /dev/null +++ b/dmake/unix/bsdarm32/stdlib.h @@ -0,0 +1,44 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); +extern free(); +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/bsdarm32/string.h b/dmake/unix/bsdarm32/string.h new file mode 100644 index 000000000000..c8abdf137696 --- /dev/null +++ b/dmake/unix/bsdarm32/string.h @@ -0,0 +1,42 @@ +/* RCS $Id: string.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- string function headers +-- +-- DESCRIPTION +-- Supply correct definitions for certain string functions. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + + +/* +** BSD does this wrong +*/ +#include </usr/include/string.h> + +#include "stdmacs.h" +extern char* strpbrk ANSI((const char* src, const char* any)); + +#ifndef DBUG +#define strchr(str,c) index(str,c) +#define strrchr(str,c) rindex(str,c) +#else +char *strchr ANSI((char*, char)); +char *strrchr ANSI((char*, char)); +#endif + diff --git a/dmake/unix/bsdarm32/template.mk b/dmake/unix/bsdarm32/template.mk new file mode 100644 index 000000000000..830e9958394c --- /dev/null +++ b/dmake/unix/bsdarm32/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= bsdarm32 + OSENVIRONMENT *:= diff --git a/dmake/unix/bsdarm32/tempnam.c b/dmake/unix/bsdarm32/tempnam.c new file mode 100644 index 000000000000..a645f41abcf7 --- /dev/null +++ b/dmake/unix/bsdarm32/tempnam.c @@ -0,0 +1,105 @@ +/* RCS $Id: tempnam.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- tempnam +-- +-- DESCRIPTION +-- temp file name generation routines. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/*LINTLIBRARY*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define max(A,B) (((A)<(B))?(B):(A)) + +extern char *mktemp(); +extern int access(); + +static char *cpdir(); +static char seed[4]="AAA"; + +/* BSD stdio.h doesn't define P_tmpdir, so let's do it here */ +#ifndef P_tmpdir +static char *P_tmpdir = "/tmp"; +#endif + + +char * +tempnam(dir, prefix) +const char *dir; /* use this directory please (if non-NULL) */ +const char *prefix; /* use this (if non-NULL) as filename prefix */ +{ + register char *p, *q, *tmpdir; + int tl=0, dl=0, pl; + + pl = strlen(P_tmpdir); + + if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir); + if( dir != NULL ) dl = strlen(dir); + + if( (p = malloc((unsigned)(max(max(dl,tl),pl)+16))) == NULL ) + return(NULL); + + *p = '\0'; + + if( (tl == 0) || (access( cpdir(p, tmpdir), 3) != 0) ) + if( (dl == 0) || (access( cpdir(p, dir), 3) != 0) ) + if( access( cpdir(p, P_tmpdir), 3) != 0 ) + if( access( cpdir(p, "/tmp"), 3) != 0 ) + return(NULL); + + (void) strcat(p, "/"); + if(prefix) + { + *(p+strlen(p)+5) = '\0'; + (void)strncat(p, prefix, 5); + } + + (void)strcat(p, seed); + (void)strcat(p, "XXXXXX"); + + q = seed; + while(*q == 'Z') *q++ = 'A'; + ++*q; + + if(*mktemp(p) == '\0') return(NULL); + return(p); +} + + + + +static char * +cpdir(buf, str) +char *buf; +char *str; +{ + char *p; + + if(str != NULL) + { + (void) strcpy(buf, str); + p = buf - 1 + strlen(buf); + if(*p == '/') *p = '\0'; + } + + return(buf); +} diff --git a/dmake/unix/bsdarm32/utime.c b/dmake/unix/bsdarm32/utime.c new file mode 100644 index 000000000000..9d26700d8006 --- /dev/null +++ b/dmake/unix/bsdarm32/utime.c @@ -0,0 +1,70 @@ +/* RCS $Id: utime.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- utime +-- +-- DESCRIPTION +-- Provide our own utime function. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <sys/types.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <sys/file.h> + +int +utime(name, timep) +char* name; +time_t timep[2]; +{ + struct timeval tv[2], *tvp; + struct stat buf; + int fil; + char data; + + if (timep!=0) + { + tvp = tv, tv[0].tv_sec = timep[0], tv[1].tv_sec = timep[1]; + if (utimes(name, tvp)==0) + return (0); + } + + if (stat(name, &buf) != 0) + return (-1); + if (buf.st_size != 0) { + if ((fil = open(name, O_RDWR, 0666)) < 0) + return (-1); + if (read(fil, &data, 1) < 1) { + close(fil); + return (-1); + } + lseek(fil, 0L, 0); + if (write(fil, &data, 1) < 1) { + close(fil); + return (-1); + } + close(fil); + return (0); + } else if ((fil = creat(name, 0666)) < 0) { + return (-1); + } else { + close(fil); + return (0); + } +} diff --git a/dmake/unix/coherent/config.mk b/dmake/unix/coherent/config.mk new file mode 100644 index 000000000000..9c5890c8065d --- /dev/null +++ b/dmake/unix/coherent/config.mk @@ -0,0 +1,26 @@ +# This is the COHERENT configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) -Dvoid=int + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/coherent/stdlib.h b/dmake/unix/coherent/stdlib.h new file mode 100644 index 000000000000..82ab9627cd65 --- /dev/null +++ b/dmake/unix/coherent/stdlib.h @@ -0,0 +1,44 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); +extern free(); +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/coherent/time.h b/dmake/unix/coherent/time.h new file mode 100644 index 000000000000..e3509ed8ec8b --- /dev/null +++ b/dmake/unix/coherent/time.h @@ -0,0 +1,32 @@ +/* RCS $Id: time.h,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- time_t +-- +-- DESCRIPTION +-- Properly define time_t. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef TIME_h +#define TIME_h + +typedef long time_t; /* this is the thing we use */ + +#endif TIME_h + diff --git a/dmake/unix/coherent/ver40/config.mk b/dmake/unix/coherent/ver40/config.mk new file mode 100644 index 000000000000..df2a702ea02f --- /dev/null +++ b/dmake/unix/coherent/ver40/config.mk @@ -0,0 +1,11 @@ +# This config file adds vfprintf.c and memcpy.c for those systems that +# do not have it. +# + +osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT) +CFLAGS += -I$(osredir) + +# The following sources are required for coherent version 4.0 +OSDESRC := vfprintf.c getcwd.c +SRC += $(OSDESRC) +.SETDIR=$(osredir) : $(OSDESRC) diff --git a/dmake/unix/coherent/ver40/getcwd.c b/dmake/unix/coherent/ver40/getcwd.c new file mode 100644 index 000000000000..cc2772494611 --- /dev/null +++ b/dmake/unix/coherent/ver40/getcwd.c @@ -0,0 +1,49 @@ +/* RCS $Id: getcwd.c,v 1.1.1.1 2000-09-22 15:33:34 hr Exp $ +-- +-- SYNOPSIS +-- getcwd +-- +-- DESCRIPTION +-- Wrapper for getcwd. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#if __STDC__ +char *getcwd(char *buffer, int length) +#else +char *getcwd (buffer, length) +char *buffer; +int length; +#endif +{ + extern char *getwd(); + + char *dir; + dir = getwd(); + if (dir) + { + strncpy(buffer,dir,length); + return buffer; + } + else + { + *buffer = 0; + return (char *) 0; + } +} + diff --git a/dmake/unix/coherent/ver40/make.sh b/dmake/unix/coherent/ver40/make.sh new file mode 100644 index 000000000000..1a0c850452f0 --- /dev/null +++ b/dmake/unix/coherent/ver40/make.sh @@ -0,0 +1,64 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/coherent/ver40/vfprintf.c +mv vfprintf.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver40 -O unix/coherent/ver40/getcwd.c +mv getcwd.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o objects/vfprintf.o objects/getcwd.o +cp unix/coherent/ver40/template.mk startup/config.mk diff --git a/dmake/unix/coherent/ver40/public.h b/dmake/unix/coherent/ver40/public.h new file mode 100644 index 000000000000..63ae40f18087 --- /dev/null +++ b/dmake/unix/coherent/ver40/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:54:51 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/coherent/ver40/template.mk b/dmake/unix/coherent/ver40/template.mk new file mode 100644 index 000000000000..ef23550cf651 --- /dev/null +++ b/dmake/unix/coherent/ver40/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= coherent + OSENVIRONMENT *:= ver40 diff --git a/dmake/unix/coherent/ver40/vfprintf.c b/dmake/unix/coherent/ver40/vfprintf.c new file mode 100644 index 000000000000..907230db2081 --- /dev/null +++ b/dmake/unix/coherent/ver40/vfprintf.c @@ -0,0 +1,190 @@ +/* Portable vfprintf and vprintf by Robert A. Larson <blarson@skat.usc.edu> */ + +/* Copyright 1989 Robert A. Larson. + * Distribution in any form is allowed as long as the author + * retains credit, changes are noted by their author and the + * copyright message remains intact. This program comes as-is + * with no warentee of fitness for any purpouse. + * + * Thanks to Doug Gwen, Chris Torek, and others who helped clarify + * the ansi printf specs. + * + * Please send any bug fixes and improvments to blarson@skat.usc.edu . + * The use of goto is NOT a bug. + */ + +/* Feb 9, 1989 blarson First usenet release */ + +/* This code implements the vfprintf function, without relying on + * the existance of _doprint or other system specific code. + * + * Define NOVOID if void * is not a supported type. + * + * Two compile options are available for efficency: + * INTSPRINTF should be defined if sprintf is int and returns + * the number of chacters formated. + * LONGINT should be defined if sizeof(long) == sizeof(int) + * + * They only make the code smaller and faster, they need not be + * defined. + * + * UNSIGNEDSPECIAL should be defined if unsigned is treated differently + * than int in argument passing. If this is definded, and LONGINT is not, + * the compiler must support the type unsingned long. + * + * Most quirks and bugs of the available fprintf fuction are duplicated, + * however * in the width and precision fields will work correctly + * even if fprintf does not support this. The %n format and the return + * count will only work if fprintf returns the number of characters + * formatted. + * + * Bad format strings, or those with very long width and precision + * fields (including expanded * fields) will cause undesired results. + */ + +#ifdef OSK /* os9/68k can take advantage of both */ +#define INTSPRINTF +#define LONGINT +#endif +#define NOVOID 1 + +/* This must be a typedef not a #define! */ +#ifdef NOVOID +typedef char *pointer; +#else +typedef void *pointer; +#endif + +#include <stdio.h> + +#ifdef INTSPRINTF +#define Sprintf(string,format,arg) (sprintf((string),(format),(arg))) +#else +#define Sprintf(string,format,arg) (\ + sprintf((string),(format),(arg)),\ + strlen(string)\ +) +#endif + +#include <stdarg.h> + +typedef int *intp; + +int vfprintf(dest, format, args) +FILE *dest; +register char *format; +va_list args; +{ + register char c; + register char *tp; + register int count = 0; + char tempfmt[64]; +#ifndef LONGINT + int longflag; +#endif + + tempfmt[0] = '%'; + while(c = *format++) { + if(c=='%') { + tp = &tempfmt[1]; +#ifndef LONGINT + longflag = 0; +#endif +continue_format: + switch(c = *format++) { + case 's': + *tp++ = c; + *tp = '\0'; + count += fprintf(dest, tempfmt, va_arg(args, char *)); + break; + case 'u': + case 'x': + case 'o': + case 'X': +#ifdef UNSIGNEDSPECIAL + *tp++ = c; + *tp = '\0'; +#ifndef LONGINT + if(longflag) + count += fprintf(dest, tempfmt, va_arg(args, unsigned long)); + else +#endif + count += fprintf(dest, tempfmt, va_arg(args, unsigned)); + break; +#endif + case 'd': + case 'c': + case 'i': + *tp++ = c; + *tp = '\0'; +#ifndef LONGINT + if(longflag) + count += fprintf(dest, tempfmt, va_arg(args, long)); + else +#endif + count += fprintf(dest, tempfmt, va_arg(args, int)); + break; + case 'f': + case 'e': + case 'E': + case 'g': + case 'G': + *tp++ = c; + *tp = '\0'; + count += fprintf(dest, tempfmt, va_arg(args, double)); + break; + case 'p': + *tp++ = c; + *tp = '\0'; + count += fprintf(dest, tempfmt, va_arg(args, pointer)); + break; + case '-': + case '+': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': + case ' ': + case '#': + case 'h': + *tp++ = c; + goto continue_format; + case 'l': +#ifndef LONGINT + longflag = 1; + *tp++ = c; +#endif + goto continue_format; + case '*': + tp += Sprintf(tp, "%d", va_arg(args, int)); + goto continue_format; + case 'n': + *va_arg(args, intp) = count; + break; + case '%': + default: + putc(c, dest); + count++; + break; + } + } else { + putc(c, dest); + count++; + } + } + return count; +} + +vprintf(format, args) +char *format; +va_list args; +{ + return vfprintf(stdout, format, args); +} diff --git a/dmake/unix/coherent/ver42/config.mk b/dmake/unix/coherent/ver42/config.mk new file mode 100644 index 000000000000..2ff06b6b7917 --- /dev/null +++ b/dmake/unix/coherent/ver42/config.mk @@ -0,0 +1,11 @@ +# This config file adds vfprintf.c and memcpy.c for those systems that +# do not have it. +# + +osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT) +CFLAGS += -I$(osredir) + +# The following sources are required for Coherent version 4.2 +#OSDESRC := +#SRC += $(OSDESRC) +#.SETDIR=$(osredir) : $(OSDESRC) diff --git a/dmake/unix/coherent/ver42/make.sh b/dmake/unix/coherent/ver42/make.sh new file mode 100644 index 000000000000..bfc7f8252a5d --- /dev/null +++ b/dmake/unix/coherent/ver42/make.sh @@ -0,0 +1,60 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/coherent -Dvoid=int -Iunix/coherent/ver42 -O unix/dcache.c +mv dcache.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o +cp unix/coherent/ver42/template.mk startup/config.mk diff --git a/dmake/unix/coherent/ver42/public.h b/dmake/unix/coherent/ver42/public.h new file mode 100644 index 000000000000..3921d7ccda29 --- /dev/null +++ b/dmake/unix/coherent/ver42/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:55:03 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/coherent/ver42/template.mk b/dmake/unix/coherent/ver42/template.mk new file mode 100644 index 000000000000..e5dd9f99ffac --- /dev/null +++ b/dmake/unix/coherent/ver42/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= coherent + OSENVIRONMENT *:= ver42 diff --git a/dmake/unix/config.mk b/dmake/unix/config.mk new file mode 100644 index 000000000000..a6859ceb3c50 --- /dev/null +++ b/dmake/unix/config.mk @@ -0,0 +1,39 @@ +# This is an OS specific configuration file +# It assumes that OBJDIR, TARGET and DEBUG are previously defined. +# It defines CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS +# PRINTER, PRINTFLAGS +# It augments SRC, OBJDIR, TARGET, CFLAGS, LDLIBS +# +PRINTER = hw +PRINTFLAGS = -P$(PRINTER) +STARTUPFILE = $(OS)/startup.mk +CPPFLAGS = $(CFLAGS) +LDOBJS = $(CSTARTUP) $(OBJDIR)/{$(<:f)} +LDARGS = $(LDFLAGS) -o $@ $(LDOBJS) $(LDLIBS) + +# Debug flags +DB_CFLAGS = -g -DDBUG +DB_LDFLAGS = -g +DB_LDLIBS = + +# NO Debug flags +NDB_CFLAGS = -O +NDB_LDFLAGS = -O +NDB_LDLIBS = + +# Local configuration modifications for CFLAGS. +CFLAGS += -I$(OS) + +# Sources that must be defined for each different version +OSSRC := arlib.c dirbrk.c rmprq.c ruletab.c runargv.c dcache.c +SRC += $(OSSRC) +.SETDIR=$(OS) : $(OSSRC) + +# Set source dirs so that we can find files named in this +# config file. +.SOURCE.h : $(OS) + +# See if we modify anything in the lower levels. +.IF $(OSRELEASE) != $(NULL) + .INCLUDE .IGNORE : $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/cygwin/public.h b/dmake/unix/cygwin/public.h new file mode 100644 index 000000000000..02129e2b3d3a --- /dev/null +++ b/dmake/unix/cygwin/public.h @@ -0,0 +1,172 @@ +/* $RCSfile: public.h,v $ +-- $Revision: 1.9 $ +-- last change: $Author: ihi $ $Date: 2007-10-15 15:55:15 $ +-- +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +const int in_quit ANSI((void)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + + +#endif diff --git a/dmake/unix/dcache.c b/dmake/unix/dcache.c new file mode 100644 index 000000000000..e0ebf59da553 --- /dev/null +++ b/dmake/unix/dcache.c @@ -0,0 +1,223 @@ +/* $RCSfile: dcache.c,v $ +-- $Revision: 1.9 $ +-- last change: $Author: ihi $ $Date: 2007-10-15 15:52:47 $ +-- +-- SYNOPSIS +-- Directory cache management routines. +-- +-- DESCRIPTION +-- This is the code that maintains a directory cache for each directory +-- that dmake visits. The entire directory is thus only read once and +-- the need for performing costly 'stat' calls when performing target +-- inference is much reduced. The improvement in performance should be +-- significant for NFS or remote mounted file systems. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/* For Borland 5.00 compile, for some reason they seem to insist on pulling + * in the winnt.h if __WIN32__ is defined and you include <dirent.h>. This + * is, in my opinion, a BUG! on Borland's part. + */ +#if defined(__BORLANDC__) && defined(__WIN32__) +#undef __WIN32__ +#endif + +#ifdef __APPLE__ +#include <sys/types.h> +#endif +#include <dirent.h> +#include "extern.h" +#include "sysintf.h" + + +typedef struct ent { + char *name; + uint32 hkey; + time_t mtime; + int isdir; + struct ent *next; +} Entry, *EntryPtr; + + +typedef struct mydir { + char *path; + uint32 hkey; + EntryPtr entries; + struct mydir *next; +} DirEntry, *DirEntryPtr; + +static DirEntryPtr dtab[HASH_TABLE_SIZE]; + + +/* Stat a path using the directory cache. + * + * We build a cannonical representation of the path using either an absolute + * path name if that is what 'path' is or the relative path name constructed + * from 'path' and the present value of Pwd. + * + * The present value of Pwd then gives a directory path that we search for + * in our cache using a hash lookup. If the directory component is located + * then we search the basename component of the path and return the result of + * the search: 0L if the component is not in the cache and it's time stamp + * otherwise. + * + * If the directory is not in our cache we insert it into the cache by + * openning the directory and reading all of the files within. Once read + * then we return the result of the above search. + * + * Optionally, if force is TRUE, and we did NOT read the directory to provide + * the result then stat the file anyway and update the internal cache. + */ + +PUBLIC time_t +CacheStat(path, force) +char *path; +int force; +{ + struct stat stbuf; + DirEntryPtr dp; + EntryPtr ep; + uint32 hkey; + uint16 hv; + char *fpath; + char *spath; + char *comp; + char *dir; + char *udir; /* Hold the unchanged (DcacheRespCase) directory. */ + int loaded=FALSE; + + if (If_root_path(path)) + spath = path; + else + spath = Build_path(Pwd,path); + + fpath = DmStrDup(spath); + + comp = Basename(fpath); /* Use before the Filedir() call. */ + dir = Filedir(fpath); + + /* do caching and comparing lower case if told so. */ + if( !STOBOOL(DcacheRespCase) ) { + udir = DmStrDup(dir); + strlwr(comp); + strlwr(dir); + } else + udir = dir; + + hv = Hash(dir,&hkey); + + for(dp=dtab[hv]; dp; dp=dp->next) + if (hkey == dp->hkey && strcmp(dp->path,dir) == 0) + break; + + if (!dp) { + /* Not cached yet, doing it now. */ + DIR *dirp; + struct dirent *direntp; + + if( Verbose & V_DIR_CACHE ) + printf( "%s: Caching directory [%s]\n", Pname, dir ); + + /* Load the directory, we have the right hash position already */ + loaded = TRUE; + + TALLOC(dp,1,DirEntry); + dp->next = dtab[hv]; + dtab[hv] = dp; + dp->path = DmStrDup(dir); + dp->hkey = hkey; + + /* We use the unchanged (not potentially lowercased because of + * DcacheRespCase) directory as this would fail on a case sensitive + * file system. + * Note: Using case insensitive directory caching on case sensitive + * file systems is a *BAD* idea. If in doubt use case sensitive + * directory caching even on case insensitive file systems as the + * worst case in this szenario is that /foo/bar/ and /foo/BAR/ are + * cached separately (with the same content) even though they are + * the same directory. This would only happen if different targets + * using different upper/lower case spellings for the same directory + * and is *never* a good idea. */ + if (Set_dir(udir) == 0) { + if((dirp=opendir(".")) != NIL(DIR)) { + while((direntp=readdir(dirp)) != NULL) { + TALLOC(ep,1,Entry); + ep->name = DmStrDup(direntp->d_name); /* basename only */ + if( !STOBOOL(DcacheRespCase) ) + strlwr(ep->name); + + Hash(ep->name, &ep->hkey); /* This sets ep->hkey. */ + + ep->next = dp->entries; + dp->entries = ep; + DMSTAT(direntp->d_name,&stbuf); + ep->isdir = (stbuf.st_mode & S_IFDIR); + ep->mtime = stbuf.st_mtime; + } + closedir(dirp); + } + Set_dir(Pwd); + } + } + + Hash(comp, &hkey); /* Calculate hkey. */ + + /* search in dp->entries for comp. */ + if (dp) { + for(ep=dp->entries; ep; ep=ep->next) + if(hkey == ep->hkey && strcmp(ep->name,comp) == 0) + break; + } + else + ep = NULL; + + if( force && !loaded) { + if (strlen(comp) > NameMax || DMSTAT(spath,&stbuf) != 0) { + /* Either file to long or the stat failed. */ + if (strlen(comp) > NameMax) + Warning( "File [%s] longer than value of NAMEMAX [%d].\n\ + Assume unix time 0.\n", comp, NameMax ); + if(ep) + ep->mtime = 0L; + } + else { + if (!ep) { + TALLOC(ep,1,Entry); + ep->name = DmStrDup(comp); + if( !STOBOOL(DcacheRespCase) ) + strlwr(ep->name); + Hash(ep->name, &ep->hkey); + ep->next = dp->entries; + ep->isdir = (stbuf.st_mode & S_IFDIR); + dp->entries = ep; + } + + ep->mtime = stbuf.st_mtime; + } + + if( Verbose & V_DIR_CACHE ) + printf("%s: Updating dir cache entry for [%s], new time is %ld\n", + Pname, spath, ep ? ep->mtime : 0L); + } + + if( udir != dir ) + FREE(udir); /* Keep this before the free of fpath. */ + + FREE(fpath); + return(!ep ? (time_t)0L : ((STOBOOL(Augmake) && ep->isdir)?0L:ep->mtime)); +} diff --git a/dmake/unix/dirbrk.c b/dmake/unix/dirbrk.c new file mode 100644 index 000000000000..3032a58d4e96 --- /dev/null +++ b/dmake/unix/dirbrk.c @@ -0,0 +1,53 @@ +/* RCS $Id: dirbrk.c,v 1.4 2007-10-15 15:52:59 ihi Exp $ +-- +-- SYNOPSIS +-- Define the directory separator string. +-- +-- DESCRIPTION +-- Define this string for any character that may appear in a path name +-- and can be used as a directory separator. Also provide a function +-- to indicate if a given path begins at the root of the file system. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + +#ifdef __EMX__ +/* os2 uses /, \, and : */ +/* FIXME: The OS/2 port most probably wants to use the HAVE_DRIVE_LETTERS + * macro, see extern.h. */ +char* DirBrkStr = "/\\:"; +#else +/* Unix only uses / */ +char* DirBrkStr = "/"; +#endif + +/* +** Return TRUE if the name is the full specification of a path name to a file +** starting at the root of the file system, otherwise return FALSE +*/ +PUBLIC int +If_root_path(name) +char *name; +{ + return( strchr(DirBrkStr, *name) != NIL(char) +#ifdef HAVE_DRIVE_LETTERS + || (*name && name[1] == ':' && isalpha(*name)) +#endif + ); +} diff --git a/dmake/unix/linux/config.mk b/dmake/unix/linux/config.mk new file mode 100644 index 000000000000..75bcf3c2a211 --- /dev/null +++ b/dmake/unix/linux/config.mk @@ -0,0 +1,27 @@ +# This is the SysV R3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/linux/gnu/config.mk b/dmake/unix/linux/gnu/config.mk new file mode 100644 index 000000000000..e351490a6b3d --- /dev/null +++ b/dmake/unix/linux/gnu/config.mk @@ -0,0 +1,4 @@ +# This is the Linux gnu configuration file for DMAKE +# It makes sure we include from the right place. +# +CFLAGS += -I$(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT) diff --git a/dmake/unix/linux/gnu/make.sh b/dmake/unix/linux/gnu/make.sh new file mode 100644 index 000000000000..8e0aa400a80b --- /dev/null +++ b/dmake/unix/linux/gnu/make.sh @@ -0,0 +1,193 @@ +platform=`uname -m`; export platform; + +mkdir objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O infer.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O infer.c +fi +mv infer.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O make.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O make.c +fi +mv make.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O stat.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O stat.c +fi +mv stat.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O expand.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O expand.c +fi +mv expand.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dmstring.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dmstring.c +fi +mv dmstring.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O hash.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O hash.c +fi +mv hash.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dag.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dag.c +fi +mv dag.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dmake.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dmake.c +fi +mv dmake.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O path.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O path.c +fi +mv path.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O imacs.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O imacs.c +fi +mv imacs.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O sysintf.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O sysintf.c +fi +mv sysintf.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O parse.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O parse.c +fi +mv parse.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O getinp.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O getinp.c +fi +mv getinp.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O quit.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O quit.c +fi +mv quit.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O state.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O state.c +fi +mv state.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dmdump.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O dmdump.c +fi +mv dmdump.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O macparse.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O macparse.c +fi +mv macparse.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O rulparse.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O rulparse.c +fi +mv rulparse.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O percent.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O percent.c +fi +mv percent.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O function.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O function.c +fi +mv function.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/arlib.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/arlib.c +fi +mv arlib.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/dirbrk.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/dirbrk.c +fi +mv dirbrk.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/rmprq.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/rmprq.c +fi +mv rmprq.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/ruletab.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/ruletab.c +fi +mv ruletab.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/runargv.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/runargv.c +fi +mv runargv.o objects + +if test $platform = sparc -o $platform = sparc64; then +gcc -c -ansi -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/dcache.c +else +gcc -c -I. -Iunix -Iunix/linux -Iunix/linux/gnu -O unix/dcache.c +fi +mv dcache.o objects + +gcc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o +cp unix/linux/gnu/template.mk startup/config.mk diff --git a/dmake/unix/linux/gnu/public.h b/dmake/unix/linux/gnu/public.h new file mode 100644 index 000000000000..8de24957f763 --- /dev/null +++ b/dmake/unix/linux/gnu/public.h @@ -0,0 +1,172 @@ +/* $RCSfile: public.h,v $ +-- $Revision: 1.9 $ +-- last change: $Author: ihi $ $Date: 2007-10-15 15:55:29 $ +-- +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +const int in_quit ANSI((void)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + + +#endif diff --git a/dmake/unix/linux/gnu/template.mk b/dmake/unix/linux/gnu/template.mk new file mode 100644 index 000000000000..a0bcef64097b --- /dev/null +++ b/dmake/unix/linux/gnu/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= linux + OSENVIRONMENT *:= gnu diff --git a/dmake/unix/macosx/config.mk b/dmake/unix/macosx/config.mk new file mode 100644 index 000000000000..75bcf3c2a211 --- /dev/null +++ b/dmake/unix/macosx/config.mk @@ -0,0 +1,27 @@ +# This is the SysV R3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/macosx/gnu/config.mk b/dmake/unix/macosx/gnu/config.mk new file mode 100644 index 000000000000..e351490a6b3d --- /dev/null +++ b/dmake/unix/macosx/gnu/config.mk @@ -0,0 +1,4 @@ +# This is the Linux gnu configuration file for DMAKE +# It makes sure we include from the right place. +# +CFLAGS += -I$(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT) diff --git a/dmake/unix/macosx/gnu/make.sh b/dmake/unix/macosx/gnu/make.sh new file mode 100644 index 000000000000..65929e93026a --- /dev/null +++ b/dmake/unix/macosx/gnu/make.sh @@ -0,0 +1,63 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/macosx -Iunix/macosx/gnu -O unix/macosx/tempnam.c +mv tempnam.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o \ +objects/dcache.o objects/tempnam.o +cp unix/macosx/gnu/template.mk startup/config.mk diff --git a/dmake/unix/macosx/gnu/public.h b/dmake/unix/macosx/gnu/public.h new file mode 100644 index 000000000000..e96dbb9dd34a --- /dev/null +++ b/dmake/unix/macosx/gnu/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.8 2007-10-15 15:55:41 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +PUBLIC int main ANSI((int argc, char **argv)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/macosx/gnu/template.mk b/dmake/unix/macosx/gnu/template.mk new file mode 100644 index 000000000000..672878dfa095 --- /dev/null +++ b/dmake/unix/macosx/gnu/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= macosx + OSENVIRONMENT *:= gnu diff --git a/dmake/unix/macosx/tempnam.c b/dmake/unix/macosx/tempnam.c new file mode 100644 index 000000000000..fc9eec04fb52 --- /dev/null +++ b/dmake/unix/macosx/tempnam.c @@ -0,0 +1,102 @@ +/* RCS $Id: tempnam.c,v 1.1 2001-02-23 03:44:30 pluby Exp $ +-- +-- SYNOPSIS +-- tempnam +-- +-- DESCRIPTION +-- temp file name generation routines. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/*LINTLIBRARY*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#if defined(max) +# undef max +#endif +#define max(A,B) (((A)<(B))?(B):(A)) + +extern char *mktemp(); +extern int access(); +int d_access(); + +char * +dtempnam(dir, prefix) +char *dir; /* use this directory please (if non-NULL) */ +char *prefix; /* use this (if non-NULL) as filename prefix */ +{ + static int count = 0; + register char *p, *q, *tmpdir; + int tl=0, dl=0, pl; + char buf[30]; + + pl = strlen(P_tmpdir); + + if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir); + else if( (tmpdir = getenv("TMP")) != NULL ) tl = strlen(tmpdir); + if( dir != NULL ) dl = strlen(dir); + + if( (p = malloc((unsigned)(max(max(dl,tl),pl)+13))) == NULL ) + return(NULL); + + *p = '\0'; + + if( (tl == 0) || (d_access( strcpy(p, tmpdir), 0) != 0) ) + if( (dl == 0) || (d_access( strcpy(p, dir), 0) != 0) ) + if( d_access( strcpy(p, P_tmpdir), 0) != 0 ) + if( !prefix ) + prefix = "tp"; + + if(prefix) + { + *(p+strlen(p)+2) = '\0'; + (void)strncat(p, prefix, 2); + } + + sprintf( buf, "%08x", getpid() ); + buf[6]='\0'; + (void)strcat(p, buf ); + sprintf( buf, "%04d", count++ ); + q=p+strlen(p)-6; + *q++ = buf[0]; *q++ = buf[1]; + *q++ = buf[2]; *q++ = buf[3]; + + if( (q = strrchr(p,'.')) != NULL ) *q = '\0'; + + return(p); +} + + + +d_access( name, flag ) +char *name; +int flag; +{ + extern char *DirSepStr; + char *p; + int r; + + if( name == NULL || !*name ) return(1); /* NULL dir means current dir */ + r = access( name, flag ); + p = name+strlen(name)-1; + if(*p != '/' && *p != '\\') strcat( p, DirSepStr ); + + return( r ); +} diff --git a/dmake/unix/os2/public.h b/dmake/unix/os2/public.h new file mode 100644 index 000000000000..845a16a2c80f --- /dev/null +++ b/dmake/unix/os2/public.h @@ -0,0 +1,172 @@ +/* $RCSfile: public.h,v $ +-- $Revision: 1.2 $ +-- last change: $Author: ihi $ $Date: 2007-10-15 15:55:51 $ +-- +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +const int in_quit ANSI((void)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + + +#endif diff --git a/dmake/unix/rmprq.c b/dmake/unix/rmprq.c new file mode 100644 index 000000000000..0144e18c2427 --- /dev/null +++ b/dmake/unix/rmprq.c @@ -0,0 +1,121 @@ +/* $RCSfile: rmprq.c,v $ +-- $Revision: 1.5 $ +-- last change: $Author: obo $ $Date: 2007-06-12 06:09:05 $ +-- +-- SYNOPSIS +-- Remove prerequisites code. +-- +-- DESCRIPTION +-- This code is different for DOS and for UNIX and parallel make +-- architectures since the parallel case requires the rm's to be +-- run in parallel, whereas DOS guarantees to run them sequentially. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include "extern.h" + +PUBLIC void +Remove_prq( tcp )/* +=================== + Removable targets (ie. an inferred intermediate node) are removed + by this function by running Make() on the special target .REMOVE + (pointed to by tcp). + As this function can be called from within another Make() (for example + like this: + Make()->Exec_commands()->Do_cmnd()->runargv()->..->_finished_child() + ->Update_time_stamp()->Remove_prq() ) + it is necessary to store and restore the dynamic macros when Make() + is finished. + + FIXME: Another potential problem is that while building .REMOVE another + previously started target finishes and from _finished_child() calls + Remove_prq() again. This will delete the dynamic macros and possibly + clear/reset the prerequisites of the previous .REMOVE target. +*/ +CELLPTR tcp; +{ + static LINKPTR rlp = NIL(LINK); + static int flag = 0; + static HASHPTR m_at, m_q, m_b, m_g, m_l, m_bb, m_up; + char *m_at_s, *m_g_s, *m_q_s, *m_b_s, *m_l_s, *m_bb_s, *m_up_s; + LINKPTR tlp; + + /* Unset F_MADE and F_VISITED. */ + tcp->ce_flag &= ~(F_MADE|F_VISITED); + tcp->ce_time = 0L; + + /* The idea seems to be to create a target that is used to remove + * intermediate prerequisites. Why add something to the "CeMeToo(tlp)" + * list? I don't understand this yet. + * FIXME! Either comment on what is going on or fix the code. */ + for( tlp=rlp; tlp !=NIL(LINK); tlp=tlp->cl_next ) + /* Find first target that has F_VISITED not set or F_MADE set, + * i.e. it is not currently made or already done. */ + if( (tlp->cl_prq->ce_flag & (F_VISITED|F_MADE)) != F_VISITED ) + break; + + if( tlp == NIL(LINK) ) { + TALLOC(tlp, 1, LINK); + TALLOC(tlp->cl_prq, 1, CELL); + tlp->cl_next = rlp; + rlp = tlp; + } + + *tlp->cl_prq = *tcp; + + /* We save the dynamic macro values here, as it is possible that the + * .REMOVE recipe is getting executed for a target while some other target + * is in the middle of executing it's list of recipe lines, in this case + * the values of $@ etc, must be preserved so that when we return to + * complete the other recipe we must make certain that the values of it's + * dynamic macros are unmodified. */ + + if( !flag ) { + /* Do the getting of the macros only once. */ + flag = 1; + m_at = Get_name("@", Macs, TRUE); + m_g = Get_name(">", Macs, TRUE); + m_q = Get_name("?", Macs, TRUE); + m_b = Get_name("<", Macs, TRUE); + m_l = Get_name("&", Macs, TRUE); + m_bb = Get_name("*", Macs, TRUE); + m_up = Get_name("^", Macs, TRUE); + } + + m_at_s = m_at->ht_value; m_at->ht_value = NIL(char); + m_g_s = m_g->ht_value; m_g->ht_value = NIL(char); + m_q_s = m_q->ht_value; m_q->ht_value = NIL(char); + m_b_s = m_b->ht_value; m_b->ht_value = NIL(char); + m_l_s = m_l->ht_value; m_l->ht_value = NIL(char); + m_bb_s = m_bb->ht_value; m_bb->ht_value = NIL(char); + m_up_s = m_up->ht_value; m_up->ht_value = NIL(char); + + Make( tlp->cl_prq, tcp ); + if( tlp->cl_prq->ce_dir ){ + FREE(tlp->cl_prq->ce_dir); + tlp->cl_prq->ce_dir=NIL(char); + } + + m_at->ht_value = m_at_s; + m_g->ht_value = m_g_s; + m_q->ht_value = m_q_s; + m_b->ht_value = m_b_s; + m_l->ht_value = m_l_s; + m_bb->ht_value = m_bb_s; + m_up->ht_value = m_up_s; +} diff --git a/dmake/unix/ruletab.c b/dmake/unix/ruletab.c new file mode 100644 index 000000000000..d815a4f15d18 --- /dev/null +++ b/dmake/unix/ruletab.c @@ -0,0 +1,44 @@ +/* $RCSfile: ruletab.c,v $ +-- $Revision: 1.9 $ +-- last change: $Author: ihi $ $Date: 2007-10-15 15:53:13 $ +-- +-- SYNOPSIS +-- Default initial configuration of dmake. +-- +-- DESCRIPTION +-- Define here the initial set of rules that are defined before +-- dmake performs any processing. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/* These are control macros for dmake that MUST be defined at some point + * if they are NOT dmake will not work! These are default definitions. They + * may be overridden inside the .STARTUP makefile, they are here + * strictly so that dmake can parse the STARTUP makefile */ + +static char *_rules[] = { + "MAXPROCESSLIMIT := 64", + "MAXLINELENGTH := 32766", +#include "dmakeroot.h" + ".IMPORT .IGNORE: DMAKEROOT", + ".MAKEFILES : makefile.mk Makefile makefile", + ".SOURCE : .NULL", +#include "startup.h" + 0 }; + +char **Rule_tab = _rules; /* for sundry reasons in Get_environment() */ diff --git a/dmake/unix/runargv.c b/dmake/unix/runargv.c new file mode 100644 index 000000000000..4be342bbb273 --- /dev/null +++ b/dmake/unix/runargv.c @@ -0,0 +1,1101 @@ +/* $RCSfile: runargv.c,v $ +-- $Revision: 1.14 $ +-- last change: $Author: kz $ $Date: 2008-03-05 18:39:41 $ +-- +-- SYNOPSIS +-- Invoke a sub process. +-- +-- DESCRIPTION +-- Use the standard methods of executing a sub process. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ +/* +This file (runargv.c) provides all the parallel process handling routines +for dmake on unix like operating systems. The following text briefly +describes the process flow. + +Exec_commands() [make.c] builds the recipes associated to the given target. + They are build sequentially in a loop that calls Do_cmnd() for each of them. + +Do_cmnd() [sysintf.c] feeds the given command or command group to runargv(). + +The following flowchart decripes the process flow starting with runargv, +descriptions for each of the functions are following. + + +--------------------------------+ + | runargv | <+ + +--------------------------------+ | + | ^ | + | | returns if | + | calls | wfc is false | + v | | + +--------------------------------+ | + | _add_child | | + +--------------------------------+ | + | ^ | + | calls if | | if another process + | wfc is true | returns | is queued: + v | | recursive call + +--------------------------------+ | + | Wait_for_Child | | + +--------------------------------+ | + | ^ | + | | process queue | + | calls | is empty | + v | | + +--------------------------------+ | + | _finished_child | -+ + +--------------------------------+ + + + +runargv() [unix/runargv] The runargv function manages up to MAXPROCESS + process queues (_procs[i]) for parallel process execution and hands + the actual commands down to the operating system. + Each of the process queues handles the sequential execution of commands + that belong to that process queue. Usually this means the sequential + execution of the recipe lines that belong to one target. + Even in non parallel builds (MAXPROCESS==1) child processes are + created and handled. + If recipes for a target are currently running attach them to the + corresponding process queue (_procs[i]) of that target and return. + If the maximum number (MAXPROCESS) of concurrently running queues is + reached use Wait_for_child(?, -1) to wait for a process queue to become + available. + New child processes are started using: + spawn: posix_spawnp (POSIX) or spawnvp (cygwin). + fork/execvp: Create a client process with fork and run the command + with execvp. + The parent calls _add_child() to track the child. + +_add_child(..., wfc) [unix/runargv] creates (or reuses) a process queue + and enters the child's parameters. + If wfc (wait for completion) is TRUE the function calls + Wait_for_child to wait for the whole process queue to be finished. + +Wait_for_child(abort_flg, pqid) [unix/runargv] waits either for the current + process from process queue pqid to finish or if the W_WFC attribute is + set for all entries of that process queue (recursively) to finish. + All finished processes are handled by calling _finished_child() for each + of them. + If pqid == -1 wait for the next process to finish but honor the A_WFC + attribute of that process (queue) and wait for the whole queue if needed. + If abort_flg is TRUE no further processes will be added to any process + queue. + If a pqid is given but a process from another process queue finishes + first that process is handled and A_WFC is also honored. + All finished processes are processed until the process from the given pqid + is reached or gone (might have been handled while finishing another process + queue). + +_finished_child(pid, status) [unix/runargv] handles the finished child. If + there are more commands in the corresponding process queue start the next + with runargv(). +*/ + +#include <signal.h> + +#include "extern.h" + +#ifdef HAVE_WAIT_H +# include <wait.h> +#else +# ifdef HAVE_SYS_WAIT_H +# include <sys/wait.h> +# endif +#endif + +#if HAVE_SPAWN_H && ENABLE_SPAWN +# include <spawn.h> +#endif + +#if __CYGWIN__ && ENABLE_SPAWN +# include <process.h> +#endif + +#ifdef __EMX__ +# include <process.h> +#define _P_NOWAIT P_NOWAIT +#endif + +#include "sysintf.h" +#if HAVE_ERRNO_H +# include <errno.h> +#else + extern int errno; +#endif + +typedef struct prp { + char *prp_cmd; + int prp_group; + t_attr prp_attr; + int prp_last; + struct prp *prp_next; +} RCP, *RCPPTR; + +#if defined(USE_CREATEPROCESS) + /* MS's HANDLE is basically a (void *) (winnt.h). */ +typedef HANDLE DMHANDLE; +#else +typedef int DMHANDLE; +#endif + +typedef struct pr { + int pr_valid; + DMHANDLE pr_pid; + DMHANDLE pr_tid; + CELLPTR pr_target; + int pr_ignore; + int pr_last; + int pr_wfc; + RCPPTR pr_recipe; + RCPPTR pr_recipe_end; + char *pr_dir; +} PR; + +typedef struct tpid { + DMHANDLE pid; + DMHANDLE tid; +} TPID; + +const TPID DMNOPID = { (DMHANDLE)-1, (DMHANDLE)0 }; + +static PR *_procs = NIL(PR); /* Array to hold concurrent processes. */ +static int _procs_size = 0; /* Savegard to find MAXPROCESS changes. */ +static int _proc_cnt = 0; /* Number of running processes. */ +static int _abort_flg= FALSE; +static int _use_i = -1; +#if defined(USE_CREATEPROCESS) +static HANDLE *_wpList = NIL(HANDLE); /* Array to hold pids to wait for. */ +#endif + +static int _add_child ANSI((TPID, CELLPTR, int, int, int)); +static void _attach_cmd ANSI((char *, int, CELLPTR, t_attr, int)); +static void _finished_child ANSI((DMHANDLE, int)); +static int _running ANSI((CELLPTR)); + +/* Machine/OS dependent helpers. */ +static int dmwaitnext ANSI((DMHANDLE *, int *)); +static int dmwaitpid ANSI((int, DMHANDLE *, int *)); + +#if defined( USE_SPAWN ) + +int terrno; /* Temporarily store errno. */ + +static TPID dmspawn ANSI((char **)); + +static TPID +dmspawn( argv ) + char **argv; +{ + TPID pid; + + /* No error output is done here as stdout/stderr might be redirected. */ +#if defined( __CYGWIN__) || defined( __EMX__) + pid.pid = spawnvp(_P_NOWAIT, argv[0], (const char**) argv); + pid.tid = 0; +#elif defined(USE_CREATEPROCESS) + static STARTUPINFO si; + static int initSTARTUPINFO = FALSE; + PROCESS_INFORMATION pi; + + /* si can be reused. */ + if( initSTARTUPINFO == FALSE ) { + initSTARTUPINFO = TRUE; + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + } + ZeroMemory( &pi, sizeof(pi) ); + + /* Start the child process. CreateProcess() parameters: + * No module name (use command line). + * Command line. This fails if the path to the program contains spaces. + * Process handle not inheritable. + * Thread handle not inheritable. + * Set handle inheritance (stdout, stderr, etc.) to TRUE. + * No creation flags. + * Use parent's environment block. + * Use parent's starting directory. + * Pointer to STARTUPINFO structure. + * Pointer to PROCESS_INFORMATION structure. */ + if( CreateProcess(NULL, argv[0], NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) ) { + pid.pid = pi.hProcess; + pid.tid = pi.hThread; + } else { + fprintf(stderr, "CreateProcess failed (%d).\n", GetLastError() ); + pid.pid = (DMHANDLE)-1; + } +#else /* Non cygwin, OS/2, MinGW and MSC */ + int tpid; + if (posix_spawnp (&tpid, argv[0], NULL, NULL, argv, (char *)NULL)) + tpid = -1; /* posix_spawn failed */ + + pid.pid = tpid; + pid.tid = 0; +#endif /* __CYGWIN__ */ + return pid; +} + +#endif /* USE_SPAWN */ + +static int +dmwaitnext( wid, status ) + DMHANDLE *wid; /* Id we waited for. */ + int *status; /* status of the finished process. */ + /* return 1 if a process finished, -1 if there + * was nothing to wait for (ECHILD) and -2 for other errors. */ +{ + +#if !defined(USE_CREATEPROCESS) + /* Here might be the culprit for the famous OOo build hang. If + * cygwin manages to "loose" a process and none else is left the + * wait() will wait forever. */ + *wid = wait(status); + + /* If ECHILD is set from waitpid/wait then no child was left. */ + if( *wid == -1 ) { + fprintf(stderr, "%s: Internal Error: wait() failed: %d - %s\n", + Pname, errno, strerror(errno) ); + if(errno != ECHILD) { + /* Wait was interrupted or a child was terminated (SIGCHLD) */ + return -2; + } else { + return -1; + } + } +#else + DWORD pEvent; + DWORD dwExitCode; + int i; + int numProc = 0; + + *status = 0; + + /* Create a list of possible objects to wait for. */ + for( i=0; i<Max_proc; i++ ) { + if(_procs[i].pr_valid) { + _wpList[numProc++] = _procs[i].pr_pid; + } + } + if( numProc == 0 ) { + fprintf(stderr, "%s: Internal Error: dmwaitnext() failed: " + "Nothing to wait for.\n", Pname ); + return -1; + } + + /* Wait ... */ + /* number of objects in array, array of objects, + * wait for any object, wait for the next child to finish */ + pEvent = WaitForMultipleObjects( numProc, _wpList, FALSE, INFINITE); + + if( pEvent >= 0 && pEvent < WAIT_OBJECT_0 + numProc ) { + *wid = _wpList[pEvent - WAIT_OBJECT_0]; + for( i=0; i<Max_proc && _procs[i].pr_pid != *wid; i++ ) + ; + if( i == Max_proc ) + Fatal("Internal Error: Process not in pq !"); + + GetExitCodeProcess(*wid, &dwExitCode); + if(dwExitCode == STILL_ACTIVE) { + /* Process did not terminate -> force it, with exit code 1. */ + TerminateProcess(*wid, 1); + dwExitCode = 1; + fprintf(stderr, "%s: Internal Error: Process still running - " + "terminate it!\n", Pname ); + } + + /* Close process and thread handles. */ + CloseHandle( *wid ); + CloseHandle( _procs[i].pr_tid ); + *status = dwExitCode; + } + else { + int err = GetLastError(); + LPVOID lpMsgBuf; + + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + fprintf(stderr, "%s: Internal Error: WaitForMultipleObjects() (%d) failed:" + " %d - %s\n", Pname, numProc, err, lpMsgBuf); + LocalFree(lpMsgBuf); + + /* No way to identify something comparable to ECHILD, always return -2.*/ + return -2; + } + +#endif + return 1; +} + + +static int +dmwaitpid( pqid, wid, status ) + int pqid; /* Process queue to wait for. */ + DMHANDLE *wid; /* Id we waited for. */ + int *status; /* status of the finished process. */ + /* return 1 if the process finished, 0 if it didn't finish yet, -1 if there + * was nothing to wait for (ECHILD) and -2 for other errors. */ +{ + +#if !defined(USE_CREATEPROCESS) + *wid = waitpid(_procs[pqid].pr_pid, status, WNOHANG); + + /* Process still running. */ + if( *wid == 0 ) { + *status = 0; + return 0; + } + /* If ECHILD is set from waitpid/wait then no child was left. */ + if( *wid == -1 ) { + fprintf(stderr, "%s: Internal Error: waitpid() failed: %d - %s\n", + Pname, errno, strerror(errno) ); + if(errno != ECHILD) { + /* Wait was interrupted or a child was terminated (SIGCHLD) */ + return -2; + } else { + return -1; + } + } +#else + DWORD pEvent; + DWORD dwExitCode; + + *wid = _procs[pqid].pr_pid; + *status = 0; + + /* Wait ... (Check status and return) */ + pEvent = WaitForSingleObject(*wid, 0); + + if( pEvent == WAIT_OBJECT_0 ) { + GetExitCodeProcess(*wid, &dwExitCode); + if(dwExitCode == STILL_ACTIVE) { + /* Process did not terminate -> force it, with exit code 1. */ + TerminateProcess(*wid, 1); + dwExitCode = 1; + fprintf(stderr, "%s: Internal Error: Process still running - " + "terminate it!\n", Pname ); + } + + /* Close process and thread handles. */ + CloseHandle( *wid ); + CloseHandle( _procs[pqid].pr_tid ); + *status = dwExitCode; + } + else if( pEvent == WAIT_TIMEOUT ) { + return 0; + } + else { + int err = GetLastError(); + LPVOID lpMsgBuf; + + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + err, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + fprintf(stderr, "%s: Internal Error: WaitForSingleObject() failed:" + " %d - %s\n", Pname, err, lpMsgBuf); + LocalFree(lpMsgBuf); + + /* No way to identify something comparable to ECHILD, always return -2.*/ + return -2; + } +#endif + + return 1; +} + + +#if ! HAVE_STRERROR +static char * +private_strerror (errnum) + int errnum; +{ +#ifndef __APPLE__ +# if defined(arm32) || defined(linux) || defined(__FreeBSD__) || defined(__OpenBSD__) + extern const char * const sys_errlist[]; +# else + extern char *sys_errlist[]; +# endif +#endif + extern int sys_nerr; + + if (errnum > 0 && errnum <= sys_nerr) + return sys_errlist[errnum]; + return "Unknown system error"; +} +#define strerror private_strerror +#endif /* HAVE_STRERROR */ + +PUBLIC int +runargv(target, group, last, cmnd_attr, cmd)/* +============================================== + Execute the command given by cmd. + + Return 0 if the command executed and finished or + 1 if the command started and is running. + */ +CELLPTR target; +int group; +int last; +t_attr cmnd_attr; /* Attributes for current cmnd. */ +char **cmd; /* Simulate a reference to *cmd. */ +{ + int ignore = (cmnd_attr & A_IGNORE)!= 0; /* Ignore errors ('-'). */ + int shell = (cmnd_attr & A_SHELL) != 0; /* Use shell ('+'). */ + int mute = (cmnd_attr & A_MUTE) != 0; /* Mute output ('@@'). */ + int wfc = (cmnd_attr & A_WFC) != 0; /* Wait for completion. */ + + TPID pid; + int st_pq = 0; /* Current _exec_shell target process index */ + char *tcmd = *cmd; /* For saver/easier string arithmetic on *cmd. */ + char **argv; + + int old_stdout = -1; /* For shell escapes and */ + int old_stderr = -1; /* @@-recipe silencing. */ + int internal = 0; /* Used to indicate internal command. */ + + DB_ENTER( "runargv" ); + + /* Special handling for the shell function macro is required. If the + * currend command is called as part of a shell escape in a recipe make + * sure that all previous recipe lines of this target have finished. */ + if( Is_exec_shell ) { + if( (st_pq = _running(Shell_exec_target)) != -1 ) { + RCPPTR rp; + /* Add WFC to _procs[st_pq]. */ + _procs[st_pq].pr_wfc = TRUE; + /* Set also the A_WFC flag in the recipe attributes. */ + for( rp = _procs[st_pq].pr_recipe ; rp != NIL(RCP); rp = rp->prp_next ) + rp->prp_attr |= A_WFC; + + Wait_for_child(FALSE, st_pq); + } + } else { + if( _running(target) != -1 /*&& Max_proc != 1*/ ) { + /* The command will be executed when the previous recipe + * line completes. */ + _attach_cmd( *cmd, group, target, cmnd_attr, last ); + DB_RETURN( 1 ); + } + } + + /* If all process array entries are used wait until we get a free + * slot. For Max_proc == 1 this forces sequential execution. */ + while( _proc_cnt == Max_proc ) { + Wait_for_child(FALSE, -1); + } + + /* Return immediately for empty line or noop command. */ + if ( !*tcmd || /* empty line */ + ( strncmp(tcmd, "noop", 4) == 0 && /* noop command */ + (iswhite(tcmd[4]) || tcmd[4] == '\0')) ) { + internal = 1; + } + else if( !shell && /* internal echo only if not in shell */ + strncmp(tcmd, "echo", 4) == 0 && + (iswhite(tcmd[4]) || tcmd[4] == '\0') ) { + int nl = 1; + + tcmd = tcmd+4; + while( iswhite(*tcmd) ) ++tcmd; + if ( strncmp(tcmd,"-n",2 ) == 0) { + nl = 0; + tcmd = tcmd+2; + while( iswhite(*tcmd) ) ++tcmd; + } + + /* redirect output for _exec_shell / @@-recipes. */ + if( Is_exec_shell ) { + /* Add error checking? */ + old_stdout = dup(1); + dup2( fileno(stdout_redir), 1 ); + } + if( mute ) { + old_stderr = dup(2); + dup2( zerofd, 2 ); + + if( !Is_exec_shell ) { + old_stdout = dup(1); + dup2( zerofd, 1 ); + } + } + + printf("%s%s", tcmd, nl ? "\n" : ""); + fflush(stdout); + + /* Restore stdout/stderr if needed. */ + if( old_stdout != -1 ) { + dup2(old_stdout, 1); + close(old_stdout); + if( old_stderr != -1 ) { + dup2(old_stderr, 2); + close(old_stderr); + } + } + + internal = 1; + } + if ( internal ) { + /* Use _add_child() / _finished_child() with internal command. */ + int cur_proc = _add_child(DMNOPID, target, ignore, last, FALSE); + _finished_child( (DMHANDLE)-cur_proc, 0 ); + DB_RETURN( 0 ); + } + + /* Pack cmd in argument vector. */ + argv = Pack_argv( group, shell, cmd ); + + /* Really spawn or fork a child. */ +#if defined( USE_SPAWN ) + /* As no other childs are started while the output is redirected this + * is save. */ + if( Is_exec_shell ) { + /* Add error checking? */ + old_stdout = dup(1); + dup2( fileno(stdout_redir), 1 ); + } + if( mute ) { + old_stderr = dup(2); + dup2( zerofd, 2 ); + + if( !Is_exec_shell ) { + old_stdout = dup(1); + dup2( zerofd, 1 ); + } + } + + pid = dmspawn( argv ); + terrno = errno; + + if( old_stdout != -1 ) { + dup2(old_stdout, 1); + close(old_stdout); + if( old_stderr != -1 ) { + dup2(old_stderr, 2); + close(old_stderr); + } + } + if(pid.pid == (DMHANDLE)-1) { + /* spawn failed */ + int cur_proc; + + fprintf(stderr, "%s: Error executing '%s': %s", + Pname, argv[0], strerror(terrno) ); + if( ignore||Continue ) { + fprintf(stderr, " (Ignored)" ); + } + fprintf(stderr, "\n"); + + /* Use _add_child() / _finished_child() to treat the failure + * gracefully, if so requested. */ + cur_proc = _add_child(DMNOPID, target, ignore, last, FALSE); + _finished_child((DMHANDLE)cur_proc, SIGTERM); + + /* _finished_child() aborts dmake if we are not told to + * ignore errors. If we reach the this point return 0 as + * errors are obviously ignored and indicate that the process + * finished. */ + DB_RETURN( 0 ); + } else { + _add_child(pid, target, ignore, last, wfc); + } +#else /* USE_SPAWN */ + + fflush(stdout); + switch( pid.pid = fork() ){ + + case -1: /* fork failed */ + Fatal("fork failed: %s: %s", argv[0], strerror( errno )); + + case 0: /* child */ + /* redirect output for _exec_shell / @@-recipes. */ + if( Is_exec_shell ) { + /* Add error checking? */ + old_stdout = dup(1); + dup2( fileno(stdout_redir), 1 ); + } + if( mute ) { + old_stderr = dup(2); + dup2( zerofd, 2 ); + + if( !Is_exec_shell ) { + old_stdout = dup(1); + dup2( zerofd, 1 ); + } + } + execvp(argv[0], argv); + /* restoring output to catch potential error output if execvp() + * failed. */ + if( old_stdout != -1 ) { + dup2(old_stdout, 1); + close(old_stdout); + if( old_stderr != -1 ) { + dup2(old_stderr, 2); + close(old_stderr); + } + } + fprintf(stderr, "%s: Error executing '%s': %s", + Pname, argv[0], strerror(errno) ); + if( ignore||Continue ) { + fprintf(stderr, " (Ignored)" ); + } + fprintf(stderr, "\n"); + + kill(getpid(), SIGTERM); + /*NOTREACHED*/ + Fatal("\nInternal Error - kill could't kill child %d.\n", getpid()); + + default: /* parent */ + _add_child(pid, target, ignore, last, wfc); + } + +#endif /* USE_SPAWN */ + + /* If wfc is set this command must have been finished. */ + if( wfc ) { + DB_RETURN( 0 ); + } else { + DB_RETURN( 1 ); + } +} + + +PUBLIC int +Wait_for_child( abort_flg, pqid )/* +=================================== + Wait for the next processes from process queue pqid to finish. All finished + processes are handled by calling _finished_child() for each of them. + If pqid == -1 wait for the next process to finish. + If abort_flg is TRUE no further processes will be added to any process + queue. The A_WFC attribute is honored, see the documentation at the top + of this file. + Return 0 if we successfully waited for a process and -1 if there was nothing + to wait for. +*/ +int abort_flg; +int pqid; +{ + DMHANDLE pid; + DMHANDLE wid; + int status; + int waitret; /* return value of the dmwait functions. */ + /* Never wait for internal commands. */ + int waitchild; + int is_exec_shell_status = Is_exec_shell; + + if( !_procs ) { + /* No process was ever created, i.e. _procs is not yet initialized. + * Nothing to wait for. */ + return -1; + } + + if( pqid > Max_proc ) Fatal("Internal Error: pqid > Max_proc !"); + + if( pqid == -1 ) { + /* Check if there is something to wait for. */ + int i; + for( i=0; i<Max_proc && !_procs[i].pr_valid; i++ ) + ; + if( i == Max_proc ) + return(-1); + + pid = (DMHANDLE)-1; + waitchild = FALSE; + } + else { + /* Check if pqid is active. */ + if( !_procs[pqid].pr_valid ) { + /* Make this an error? */ + Warning("Internal Warning: pqid is not active!?"); + return(-1); + } + + pid = _procs[pqid].pr_pid; + waitchild = _procs[pqid].pr_wfc; + } + + + /* It is impossible that processes that were started from _exec_shell + * have follow-up commands in its process entry. Unset Is_exec_shell + * to prevent piping of child processes that are started from the + * _finished_child subroutine and reset to its original value when + * leaving this function. */ + Is_exec_shell = FALSE; + + do { + /* Wait for the next process to finish. */ + if( (pid != (DMHANDLE)-1) && (waitret = dmwaitpid(pqid, &wid, &status)) != 0 ) { + /* if dmwaitpid returns 0 this means that pid didn't finish yet. + * In this case just handle the next finished process in the + * following "else". If an error is returned (waitret < 0) the else + * clause is not evaluated and the error is handled in the following + * lines. If a process was waited for (waitret == 0) also proceed to + * the following lines. */ + ; + } + else { + waitret = dmwaitnext(&wid, &status); + /* If we get an error tell the error handling routine below that we + * were not waiting for a specific pid. */ + if( waitret < 0 ) { + pid = (DMHANDLE)-1; + } + } + + /* If ECHILD is set from waitpid/wait then no child was left. */ + if( waitret < 0 ) { + if(waitret == -2) { + /* Wait was interrupted or a child was terminated (SIGCHLD) */ + if ( in_quit() ) { + /* We're already terminating, just continue. */ + return 0; + } else { + Fatal( "dmake was interrupted or a child terminated. " + "Stopping all childs ..." ); + } + } else { + /* The child we were waiting for is missing or no child is + * left to wait for. */ + if( pid != (DMHANDLE)-1 ) { + /* If we know the pid disable the pq entry. */ + if( _procs[pqid].pr_valid ) { + _procs[pqid].pr_valid = 0; + _procs[pqid].pr_recipe = NIL(RCP); + _proc_cnt--; + } + } else { + /* otherwise disable all remaining pq's. As we don't know + * which pid failed there is no gracefull way to terminate. */ + int i; + for( i=0; i<Max_proc; i++ ) { + _procs[i].pr_valid = 0; + _procs[i].pr_recipe = NIL(RCP); + } + _proc_cnt = 0; + } + /* The pid we were waiting for or any of the remaining childs + * (pid == -1) is missing. This should not happen and means + * that the process got lost or was treated elsewhere. */ + Fatal( "Internal Error: Child is missing but still listed in _procs[x] %d: %s\n" + "\nTemporary or .ERRREMOVE targets might not have been removed!\n", + errno, strerror( errno ) ); + } + } + + _abort_flg = abort_flg; + _finished_child(wid, status); + _abort_flg = FALSE; + if( waitchild ) { + /* If pid != wid the process we're waiting for might have been + * finished from a "Wait_for_child(FALSE, -1)" call from + * _finished_child() -> runargv(). */ + if( pid != wid ) { + if( !_procs[pqid].pr_valid || _procs[pqid].pr_pid != pid ) { + /* Someone finished pid, no need to wait further. */ + waitchild = FALSE; + } + } + else + /* We finished pid, no need to wait further. */ + waitchild = FALSE; + } + } + while( waitchild ); + + Is_exec_shell = is_exec_shell_status; + return(0); +} + + +PUBLIC void +Clean_up_processes() +{ + register int i; + int ret; + + if( _procs != NIL(PR) ) { + for( i=0; i<Max_proc; i++ ) + if( _procs[i].pr_valid ) { +#if !defined(USE_CREATEPROCESS) + if( (ret = kill(_procs[i].pr_pid, SIGTERM)) ) { + fprintf(stderr, "Killing of pid %d from pq[%d] failed with: %s - %d ret: %d\n", + _procs[i].pr_pid, i, + strerror(errno), SIGTERM, ret ); + } +#else + TerminateProcess(_procs[i].pr_pid, 1); +#endif + } + } +} + + +static int +_add_child( pid, target, ignore, last, wfc )/* +============================================== + Creates/amend a process queue entry and enters the child parameters. + The pid == -1 represents an internal command and the function returns + the used process array index. For non-internal commands the function + returns -1. + If wfc (wait for completion) is TRUE the function calls + Wait_for_child to wait for the whole process queue to be finished. +*/ +TPID pid; +CELLPTR target; +int ignore; +int last; +int wfc; +{ + register int i; + register PR *pp; + + /* Never change MAXPROCESS after _procs is allocated. */ + if( _procs_size != Max_proc ) { + /* If procs was never initialize this is OK, do it now. */ + if( _procs == NIL(PR) ) { + _procs_size = Max_proc; + TALLOC( _procs, Max_proc, PR ); +#if defined(USE_CREATEPROCESS) + TALLOC( _wpList, Max_proc, HANDLE ); + + /* Signed int values are cast to DMHANDLE in various places, use this + * sanity check to verify that DMHANDLE is large enough. */ + if( sizeof(int) > sizeof(DMHANDLE) ) + Fatal( "Internal Error: Check type of DMHANDLE!" ); +#endif + } + else { + Fatal( "MAXPROCESS changed from `%d' to `%d' after a command was executed!", _procs_size, Max_proc ); + } + } + + if( Measure & M_RECIPE ) + Do_profile_output( "s", M_RECIPE, target ); + + /* If _use_i!=-1 then this function is called by _finished_child() + * ( through runargv() ). */ + if( (i = _use_i) == -1 ) { + for( i=0; i<Max_proc; i++ ) + if( !_procs[i].pr_valid ) + break; + } + else { + /* Re-use the process queue number given by _use_i. + * Free the pointer before using it again below. */ + FREE( _procs[i].pr_dir ); + } + + pp = _procs+i; + + pp->pr_valid = 1; + pp->pr_pid = pid.pid; + pp->pr_tid = pid.tid; + pp->pr_target = target; + pp->pr_ignore = ignore; + pp->pr_last = last; + pp->pr_wfc = wfc; + /* Freed above and after the last recipe in _finished child(). */ + pp->pr_dir = DmStrDup(Get_current_dir()); + + Current_target = NIL(CELL); + + _proc_cnt++; + + if( pid.pid != (DMHANDLE)-1 ) { + /* Wait for each recipe to finish if wfc is TRUE. This + * basically forces sequential execution. */ + if( wfc ) { + Wait_for_child( FALSE, i ); + } + + return -1; + } else + return i; +} + + +static void +_finished_child(cid, status)/* +============================== + Handle process array entry for finished child. This can be a finished + process or a finished internal command depending on the content of cid. + For cid >= 1 the value of cid is used as the pid to of the finished + process and for cid < 1 -cid is used as the process array index of the + internal command. +*/ +DMHANDLE cid; +int status; +{ + register int i; + char *dir; + + if((int)cid < 1) { /* Force int. */ + /* internal command */ + i = -((int)cid); + } + else { + for( i=0; i<Max_proc; i++ ) + if( _procs[i].pr_valid && _procs[i].pr_pid == cid ) + break; + + /* Some children we didn't make esp true if using /bin/sh to execute a + * a pipe and feed the output as a makefile into dmake. */ + if( i == Max_proc ) { + Warning("Internal Warning: finished pid %d is not in pq!?", cid); + return; + } + } + + /* Not a running process anymore, the next runargv() will not use + * _attach_cmd(). */ + _procs[i].pr_valid = 0; + + if( Measure & M_RECIPE ) + Do_profile_output( "e", M_RECIPE, _procs[i].pr_target ); + + _proc_cnt--; + dir = DmStrDup(Get_current_dir()); + Set_dir( _procs[i].pr_dir ); + + if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) { + RCPPTR rp = _procs[i].pr_recipe; + + + Current_target = _procs[i].pr_target; + Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target ); + Current_target = NIL(CELL); + + if ( _procs[i].pr_target->ce_attr & A_ERROR ) { + _procs[i].pr_last = TRUE; + goto ABORT_REMAINDER_OF_RECIPE; + } + + _procs[i].pr_recipe = rp->prp_next; + + _use_i = i; + /* Run next recipe line. The rp->prp_attr propagates a possible + * wfc condition. */ + runargv( _procs[i].pr_target, rp->prp_group, + rp->prp_last, rp->prp_attr, &rp->prp_cmd ); + _use_i = -1; + + FREE( rp->prp_cmd ); + FREE( rp ); + + /* If all process queues are used wait for the next process to + * finish. Is this really needed here? */ + if( _proc_cnt == Max_proc ) { + Wait_for_child( FALSE, -1 ); + } + } + else { + /* empty the queue on abort. */ + if( _abort_flg ) + _procs[i].pr_recipe = NIL(RCP); + + Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target); + + ABORT_REMAINDER_OF_RECIPE: + if( _procs[i].pr_last ) { + FREE(_procs[i].pr_dir ); /* Set in _add_child() */ + + if( !Doing_bang ) { + /* Update_time_stamp() triggers the deletion of intermediate + * targets. This starts a new process queue, so we have to + * clear the _use_i variable. */ + int my_use_i = _use_i; + + _use_i = -1; + Update_time_stamp( _procs[i].pr_target ); + _use_i = my_use_i; + } + } + } + + Set_dir(dir); + FREE(dir); +} + + +static int +_running( cp )/* +================ + Check if target exists in process array AND is running. Return its + process array index if it is running, return -1 otherwise. +*/ +CELLPTR cp; +{ + register int i; + + if( !_procs ) return( -1 ); + + for( i=0; i<Max_proc; i++ ) + if( _procs[i].pr_valid && + _procs[i].pr_target == cp ) + break; + + return( i == Max_proc ? -1 : i ); +} + + +static void +_attach_cmd( cmd, group, cp, cmnd_attr, last )/* +================================================ + Attach to an active process queue. Inherit wfc setting. */ +char *cmd; +int group; +CELLPTR cp; +t_attr cmnd_attr; +int last; +{ + register int i; + RCPPTR rp; + + for( i=0; i<Max_proc; i++ ) + if( _procs[i].pr_valid && + _procs[i].pr_target == cp ) + break; + + TALLOC( rp, 1, RCP ); + rp->prp_cmd = DmStrDup(cmd); + rp->prp_attr = cmnd_attr; + /* Inherit wfc from process queue. */ + if( _procs[i].pr_wfc ) + rp->prp_attr |= A_WFC; + rp->prp_group = group; + rp->prp_last = last; + + if( _procs[i].pr_recipe == NIL(RCP) ) + _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp; + else { + _procs[i].pr_recipe_end->prp_next = rp; + _procs[i].pr_recipe_end = rp; + } +} diff --git a/dmake/unix/solaris/config.mk b/dmake/unix/solaris/config.mk new file mode 100644 index 000000000000..bc2364a33260 --- /dev/null +++ b/dmake/unix/solaris/config.mk @@ -0,0 +1,27 @@ +# This is the BSD 4.3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following sources are required for Solaris 2.1 or greater +OSDSRC := tempnam.c getcwd.c +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local BSD includes +# too. +CFLAGS += -I$(osrdir) -DSolaris + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/solaris/getcwd.c b/dmake/unix/solaris/getcwd.c new file mode 100644 index 000000000000..f2359bcc795b --- /dev/null +++ b/dmake/unix/solaris/getcwd.c @@ -0,0 +1,231 @@ +/* + getcwd -- get pathname of current working directory + + public-domain implementation + + last edit: 03-Nov-1990 Gwyn@BRL.MIL + + complies with the following standards: + IEEE Std 1003.1-1988 + SVID Issue 3 + X/Open Portability Guide Issue 2 (when "XPG2" is defined) + X/Open Portability Guide Issue 3 + + This implementation of getcwd() can be used to replace the UNIX + System V library routine (which uses popen() to capture the output of + the "pwd" command). Once that is done, "pwd" can be reimplemented as + just puts(getcwd((char*)0,0)), assuming "XPG2" is defined below. + + This implementation depends on every directory having entries for + "." and "..". It also depends on the internals of the <dirent.h> + data structures to some degree. + + I considered using chdir() to ascend the hierarchy, followed by a + final chdir() to the path being returned by getcwd() to restore the + location, but decided that error recovery was too difficult that way. + The algorithm I settled on was inspired by my rewrite of the "pwd" + utility, combined with the dotdots[] array trick from the SVR2 shell. +*/ +#define XPG2 /* define to support obsolete XPG2-mandated feature */ + + +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef M_XENIX +# include <sys/ndir.h> +# define dirent direct +#else +# include <dirent.h> +#endif + +#include <errno.h> +#include <string.h> + +typedef char *pointer; /* (void *) if you have it */ + +extern void free(); +extern pointer malloc(); +extern int fstat(), stat(); + +extern int errno; /* normally done by <errno.h> */ + +#ifndef NULL +#define NULL 0 /* amorphous null pointer constant */ +#endif + +#ifndef NAME_MAX +#define NAME_MAX 255 /* maximum directory entry size */ +#endif + + +char * +getcwd( buf, size ) /* returns pointer to CWD pathname */ + char *buf; /* where to put name (NULL to malloc) */ + int size; /* size of buf[] or malloc()ed memory */ + { + static char dotdots[] = +"../../../../../../../../../../../../../../../../../../../../../../../../../.."; + char *dotdot; /* -> dotdots[.], right to left */ + DIR *dirp; /* -> parent directory stream */ + struct dirent *dir; /* -> directory entry */ + struct stat stat1, + stat2; /* info from stat() */ + struct stat *d = &stat1; /* -> info about "." */ + struct stat *dd = &stat2; /* -> info about ".." */ + register char *buffer; /* local copy of buf, or malloc()ed */ + char *bufend; /* -> buffer[size] */ + register char *endp; /* -> end of reversed string */ + register char *dname; /* entry name ("" for root) */ + int serrno = errno; /* save entry errno */ + + if ( buf != NULL && size <= 0 +#ifndef XPG2 + || buf == NULL +#endif + ) { + errno = EINVAL; /* invalid argument */ + return NULL; + } + + buffer = buf; +#ifdef XPG2 + if ( buf == NULL /* wants us to malloc() the string */ + && (buffer = (char *) malloc( (unsigned) size )) == NULL + /* XXX -- actually should probably not pay attention to "size" arg */ + ) { + errno = ENOMEM; /* cannot malloc() specified size */ + return NULL; + } +#endif + + if ( stat( ".", dd ) != 0 ) /* prime the pump */ + goto error; /* errno already set */ + + endp = buffer; /* initially, empty string */ + bufend = &buffer[size]; + + for ( dotdot = &dotdots[sizeof dotdots]; dotdot != dotdots; ) + { + dotdot -= 3; /* include one more "/.." section */ + /* (first time is actually "..") */ + + /* swap stat() info buffers */ + { + register struct stat *temp = d; + + d = dd; /* new current dir is old parent dir */ + dd = temp; + } + + if ( (dirp = opendir( dotdot )) == NULL ) /* new parent */ + goto error; /* errno already set */ + + if ( fstat( dirp->dd_fd, dd ) != 0 ) + { + serrno = errno; /* set by fstat() */ + (void)closedir( dirp ); + errno = serrno; /* in case closedir() clobbered it */ + goto error; + } + + if ( d->st_dev == dd->st_dev ) + { /* not crossing a mount point */ + if ( d->st_ino == dd->st_ino ) + { /* root directory */ + dname = ""; + goto append; + } + + do + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + while ( dir->d_ino != d->st_ino ); + } + else { /* crossing a mount point */ + struct stat t; /* info re. test entry */ + char name[sizeof dotdots + 1 + NAME_MAX]; + + (void)strcpy( name, dotdot ); + dname = &name[strlen( name )]; + *dname++ = '/'; + + do { + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + + (void)strcpy( dname, dir->d_name ); + /* must fit if NAME_MAX is not a lie */ + } + while ( stat( name, &t ) != 0 + || t.st_ino != d->st_ino + || t.st_dev != d->st_dev + ); + } + + dname = dir->d_name; + + /* append "/" and reversed dname string onto buffer */ + append: + if ( endp != buffer /* avoid trailing / in final name */ + || dname[0] == '\0' /* but allow "/" when CWD is root */ + ) + *endp++ = '/'; + + { + register char *app; /* traverses dname string */ + + for ( app = dname; *app != '\0'; ++app ) + ; + + if ( app - dname >= bufend - endp ) + { + (void)closedir( dirp ); + errno = ERANGE; /* won't fit allotted space */ + goto error; + } + + while ( app != dname ) + *endp++ = *--app; + } + + (void)closedir( dirp ); + + if ( dname[0] == '\0' ) /* reached root; wrap it up */ + { + register char *startp; /* -> buffer[.] */ + + *endp = '\0'; /* plant null terminator */ + + /* straighten out reversed pathname string */ + for ( startp = buffer; --endp > startp; ++startp ) + { + char temp = *endp; + + *endp = *startp; + *startp = temp; + } + + errno = serrno; /* restore entry errno */ + /* XXX -- if buf==NULL, realloc here? */ + return buffer; + } + } + + errno = ENOMEM; /* actually, algorithm failure */ + + error: + if ( buf == NULL ) + free( (pointer)buffer ); + + return NULL; + } + diff --git a/dmake/unix/solaris/gnu/config.mk b/dmake/unix/solaris/gnu/config.mk new file mode 100644 index 000000000000..f6f4f2c68cbc --- /dev/null +++ b/dmake/unix/solaris/gnu/config.mk @@ -0,0 +1,8 @@ +# This is the Solaris gcc configuration file for DMAKE +# It modifies the value of CC to be gcc +# + +CC = gcc + +# disable a gcc bug when compiling runargv.c +runargv.o ?= CFLAGS += -g diff --git a/dmake/unix/solaris/gnu/make.sh b/dmake/unix/solaris/gnu/make.sh new file mode 100644 index 000000000000..10a50a837dfa --- /dev/null +++ b/dmake/unix/solaris/gnu/make.sh @@ -0,0 +1,64 @@ +mkdir objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O infer.c +mv infer.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O make.c +mv make.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O stat.c +mv stat.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O expand.c +mv expand.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O dmstring.c +mv dmstring.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O hash.c +mv hash.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O dag.c +mv dag.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O dmake.c +mv dmake.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O path.c +mv path.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O imacs.c +mv imacs.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O sysintf.c +mv sysintf.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O parse.c +mv parse.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O getinp.c +mv getinp.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O quit.c +mv quit.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O state.c +mv state.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O dmdump.c +mv dmdump.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O macparse.c +mv macparse.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O rulparse.c +mv rulparse.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O percent.c +mv percent.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O function.c +mv function.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/arlib.c +mv arlib.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/dirbrk.c +mv dirbrk.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/rmprq.c +mv rmprq.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/ruletab.c +mv ruletab.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O -g unix/runargv.c +mv runargv.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/dcache.c +mv dcache.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/solaris/tempnam.c +mv tempnam.o objects +gcc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/solaris/getcwd.c +mv getcwd.o objects +gcc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o objects/tempnam.o objects/getcwd.o +cp unix/solaris/gnu/template.mk startup/config.mk diff --git a/dmake/unix/solaris/gnu/public.h b/dmake/unix/solaris/gnu/public.h new file mode 100644 index 000000000000..e9236422a5e0 --- /dev/null +++ b/dmake/unix/solaris/gnu/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:56:16 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/solaris/gnu/template.mk b/dmake/unix/solaris/gnu/template.mk new file mode 100644 index 000000000000..3f9282027c5c --- /dev/null +++ b/dmake/unix/solaris/gnu/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= solaris + OSENVIRONMENT *:= gnu diff --git a/dmake/unix/solaris/make.sh b/dmake/unix/solaris/make.sh new file mode 100644 index 000000000000..21894778a642 --- /dev/null +++ b/dmake/unix/solaris/make.sh @@ -0,0 +1,64 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/solaris/tempnam.c +mv tempnam.o objects +cc -c -I. -Iunix -Iunix/solaris -DSolaris -O unix/solaris/getcwd.c +mv getcwd.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o objects/tempnam.o objects/getcwd.o +cp unix/solaris/template.mk startup/config.mk diff --git a/dmake/unix/solaris/public.h b/dmake/unix/solaris/public.h new file mode 100644 index 000000000000..16f322b6a94c --- /dev/null +++ b/dmake/unix/solaris/public.h @@ -0,0 +1,166 @@ +/* RCS $Id: public.h,v 1.7 2007-10-15 15:56:04 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/solaris/template.mk b/dmake/unix/solaris/template.mk new file mode 100644 index 000000000000..233917a6ba92 --- /dev/null +++ b/dmake/unix/solaris/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= solaris + OSENVIRONMENT *:= diff --git a/dmake/unix/solaris/tempnam.c b/dmake/unix/solaris/tempnam.c new file mode 100644 index 000000000000..56f23fbe21d4 --- /dev/null +++ b/dmake/unix/solaris/tempnam.c @@ -0,0 +1,103 @@ +/* RCS $Id: tempnam.c,v 1.1.1.1 2000-09-22 15:33:35 hr Exp $ +-- +-- SYNOPSIS +-- tempnam +-- +-- DESCRIPTION +-- temp file name generation routines. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +/*LINTLIBRARY*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define max(A,B) (((A)<(B))?(B):(A)) + +extern char *mktemp(); +extern int access(); + +static char *cpdir(); +static char seed[4]="AAA"; + +/* BSD stdio.h doesn't define P_tmpdir, so let's do it here */ +#ifndef P_tmpdir +static char *P_tmpdir = "/tmp"; +#endif + +char * +tempnam(dir, prefix) +const char *dir; /* use this directory please (if non-NULL) */ +const char *prefix; /* use this (if non-NULL) as filename prefix */ +{ + register char *p, *q, *tmpdir; + int tl=0, dl=0, pl; + + pl = strlen(P_tmpdir); + + if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir); + if( dir != NULL ) dl = strlen(dir); + + if( (p = malloc((unsigned)(max(max(dl,tl),pl)+16))) == NULL ) + return(NULL); + + *p = '\0'; + + if( (tl == 0) || (access( cpdir(p, tmpdir), 3) != 0) ) + if( (dl == 0) || (access( cpdir(p, dir), 3) != 0) ) + if( access( cpdir(p, P_tmpdir), 3) != 0 ) + if( access( cpdir(p, "/tmp"), 3) != 0 ) + return(NULL); + + (void) strcat(p, "/"); + if(prefix) + { + *(p+strlen(p)+5) = '\0'; + (void)strncat(p, prefix, 5); + } + + (void)strcat(p, seed); + (void)strcat(p, "XXXXXX"); + + q = seed; + while(*q == 'Z') *q++ = 'A'; + ++*q; + + if(*mktemp(p) == '\0') return(NULL); + return(p); +} + + + +static char * +cpdir(buf, str) +char *buf; +char *str; +{ + char *p; + + if(str != NULL) + { + (void) strcpy(buf, str); + p = buf - 1 + strlen(buf); + if(*p == '/') *p = '\0'; + } + + return(buf); +} diff --git a/dmake/unix/startup.h b/dmake/unix/startup.h new file mode 100644 index 000000000000..b445a86cecef --- /dev/null +++ b/dmake/unix/startup.h @@ -0,0 +1,27 @@ +/* RCS $Id: startup.h,v 1.1.1.1 2000-09-22 15:33:33 hr Exp $ +-- +-- SYNOPSIS +-- Definition of MAKESTARTUP +-- +-- DESCRIPTION +-- Default MAKESTARTUP value defining where dmake locates the +-- startup file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +"MAKESTARTUP := $(DMAKEROOT)/startup.mk", diff --git a/dmake/unix/sysintf.h b/dmake/unix/sysintf.h new file mode 100644 index 000000000000..85bd198529e8 --- /dev/null +++ b/dmake/unix/sysintf.h @@ -0,0 +1,50 @@ +/* RCS $Id: sysintf.h,v 1.4 2007-10-15 15:53:38 ihi Exp $ +-- +-- SYNOPSIS +-- Interfaces for sysintf.c +-- +-- DESCRIPTION +-- Abstractions of functions in sysintf.c +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#define DMSTAT stat +#define VOID_LCACHE(l,m) (void) void_lcache(l,m) +#define Hook_std_writes(A) +#define GETPID getpid() + +#ifndef S_IFDIR +#define S_IFDIR 0040000 +#endif + +#ifndef S_IFMT +#define S_IFMT 0170000 +#endif + +/* +** standard C items +*/ + +/* +** DOS interface standard items +*/ +#define getswitchar() '-' + +/* +** Make parameters +*/ diff --git a/dmake/unix/sysvr1/config.mk b/dmake/unix/sysvr1/config.mk new file mode 100644 index 000000000000..d1cd2d8810f5 --- /dev/null +++ b/dmake/unix/sysvr1/config.mk @@ -0,0 +1,28 @@ +# This is the SysV R3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := vfprintf.c + +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/sysvr1/make.sh b/dmake/unix/sysvr1/make.sh new file mode 100644 index 000000000000..1db251f3361e --- /dev/null +++ b/dmake/unix/sysvr1/make.sh @@ -0,0 +1,62 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/sysvr1 -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/sysvr1 -O unix/sysvr1/vfprintf.c +mv vfprintf.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o objects/vfprintf.o +cp unix/sysvr1/template.mk startup/config.mk diff --git a/dmake/unix/sysvr1/public.h b/dmake/unix/sysvr1/public.h new file mode 100644 index 000000000000..f61f0f42595f --- /dev/null +++ b/dmake/unix/sysvr1/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:56:28 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/sysvr1/putenv.c b/dmake/unix/sysvr1/putenv.c new file mode 100644 index 000000000000..1453852710c2 --- /dev/null +++ b/dmake/unix/sysvr1/putenv.c @@ -0,0 +1,78 @@ +/* RCS $Id: putenv.c,v 1.1.1.1 2000-09-22 15:33:35 hr Exp $ +-- +-- SYNOPSIS +-- My own putenv for BSD like systems. +-- +-- DESCRIPTION +-- This originally came from MKS, but I rewrote it to fix a bug with +-- replacing existing strings, probably never happened but the code +-- was wrong nonetheless. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#include <stdio.h> +#include <string.h> + +int +putenv( str )/* +=============== + Take a string of the form NAME=value and stick it into the environment. + We do this by allocating a new set of pointers if we have to add a new + string and by replacing an existing pointer if the value replaces the value + of an existing string. */ +char *str; +{ + extern char **environ; /* The current environment. */ + static char **ourenv = NULL; /* A new environment */ + register char **p; + register char *q; + int size; + + /* First search the current environment and see if we can replace a + * string. */ + for( p=environ; *p; p++ ) { + register char *s = str; + + for( q = *p; *q && *s && *s == *q; q++, s++ ) + if( *s == '=' ) { + *p = str; + return(0); /* replaced it so go away */ + } + } + + /* Ok, can't replace a string so need to grow the environment. */ + size = p - environ + 2; /* size of new environment */ + /* size of old is size-1 */ + + /* It's the first time, so allocate a new environment since we don't know + * where the old one is comming from. */ + if( ourenv == NULL ) { + if( (ourenv = (char **) malloc( sizeof(char *)*size )) == NULL ) + return(1); + + memcpy( (char *)ourenv, (char *)environ, (size-2)*sizeof(char *) ); + } + else if( (ourenv = (char **)realloc( ourenv, size*sizeof(char *))) == NULL ) + return(1); + + ourenv[--size] = NULL; + ourenv[--size] = str; + + environ = ourenv; + return(0); +} diff --git a/dmake/unix/sysvr1/stdlib.h b/dmake/unix/sysvr1/stdlib.h new file mode 100644 index 000000000000..3b612c2fd601 --- /dev/null +++ b/dmake/unix/sysvr1/stdlib.h @@ -0,0 +1,44 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:35 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); +extern free(); +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/sysvr1/template.mk b/dmake/unix/sysvr1/template.mk new file mode 100644 index 000000000000..4eb40febb3a1 --- /dev/null +++ b/dmake/unix/sysvr1/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= sysvr1 + OSENVIRONMENT *:= diff --git a/dmake/unix/sysvr1/time.h b/dmake/unix/sysvr1/time.h new file mode 100644 index 000000000000..3b3dfac5684f --- /dev/null +++ b/dmake/unix/sysvr1/time.h @@ -0,0 +1,32 @@ +/* RCS $Id: time.h,v 1.1.1.1 2000-09-22 15:33:35 hr Exp $ +-- +-- SYNOPSIS +-- time_t +-- +-- DESCRIPTION +-- Properly define time_t. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef TIME_h +#define TIME_h + +typedef long time_t; /* this is the thing we use */ + +#endif TIME_h + diff --git a/dmake/unix/sysvr1/vfprintf.c b/dmake/unix/sysvr1/vfprintf.c new file mode 100644 index 000000000000..1d24a1c19b08 --- /dev/null +++ b/dmake/unix/sysvr1/vfprintf.c @@ -0,0 +1,58 @@ +/* From: + * John Limpert johnl@gronk.UUCP uunet!n3dmc!gronk!johnl + */ + +#include <stdio.h> +#include <varargs.h> + +#ifndef BUFSIZ +#include <stdio.h> +#endif + +#ifndef va_dcl +#include <varargs.h> +#endif + +int +vsprintf(str, fmt, ap) + char *str, *fmt; + va_list ap; +{ + FILE f; + int len; + + f._flag = _IOWRT+_IOMYBUF; + f._ptr = (char *)str; /* My copy of BSD stdio.h has this as (char *) + * with a comment that it should be + * (unsigned char *). Since this code is + * intended for use on a vanilla BSD system, + * we'll stick with (char *) for now. + */ + f._cnt = 32767; + len = _doprnt(fmt, ap, &f); + *f._ptr = 0; + return (len); +} + +int +vfprintf(iop, fmt, ap) + FILE *iop; + char *fmt; + va_list ap; +{ + int len; + + len = _doprnt(fmt, ap, iop); + return (ferror(iop) ? EOF : len); +} + +int +vprintf(fmt, ap) + char *fmt; + va_list ap; +{ + int len; + + len = _doprnt(fmt, ap, stdout); + return (ferror(stdout) ? EOF : len); +} diff --git a/dmake/unix/sysvr3/config.mk b/dmake/unix/sysvr3/config.mk new file mode 100644 index 000000000000..75bcf3c2a211 --- /dev/null +++ b/dmake/unix/sysvr3/config.mk @@ -0,0 +1,27 @@ +# This is the SysV R3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/sysvr3/gnu/public.h b/dmake/unix/sysvr3/gnu/public.h new file mode 100644 index 000000000000..829293cce720 --- /dev/null +++ b/dmake/unix/sysvr3/gnu/public.h @@ -0,0 +1,165 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:56:54 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +int Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +int Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/sysvr3/make.sh b/dmake/unix/sysvr3/make.sh new file mode 100644 index 000000000000..505670f8b708 --- /dev/null +++ b/dmake/unix/sysvr3/make.sh @@ -0,0 +1,60 @@ +mkdir objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O infer.c +mv infer.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O make.c +mv make.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O stat.c +mv stat.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O expand.c +mv expand.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O dmstring.c +mv dmstring.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O hash.c +mv hash.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O dag.c +mv dag.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O dmake.c +mv dmake.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O path.c +mv path.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O imacs.c +mv imacs.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O sysintf.c +mv sysintf.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O parse.c +mv parse.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O getinp.c +mv getinp.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O quit.c +mv quit.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O state.c +mv state.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O dmdump.c +mv dmdump.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O macparse.c +mv macparse.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O rulparse.c +mv rulparse.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O percent.c +mv percent.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O function.c +mv function.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O unix/arlib.c +mv arlib.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O unix/dirbrk.c +mv dirbrk.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O unix/rmprq.c +mv rmprq.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O unix/ruletab.c +mv ruletab.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O unix/runargv.c +mv runargv.o objects +gcc -c -I. -Iunix -Iunix/sysvr3 -O unix/dcache.c +mv dcache.o objects +gcc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o +cp unix/sysvr3/template.mk startup/config.mk diff --git a/dmake/unix/sysvr3/public.h b/dmake/unix/sysvr3/public.h new file mode 100644 index 000000000000..ec7a7c1ba5f6 --- /dev/null +++ b/dmake/unix/sysvr3/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:56:41 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/sysvr3/pwd/config.mk b/dmake/unix/sysvr3/pwd/config.mk new file mode 100644 index 000000000000..86c535a64c1d --- /dev/null +++ b/dmake/unix/sysvr3/pwd/config.mk @@ -0,0 +1,20 @@ +# This is the Sys VR3 PWD configuration file. It configures SysvR3 unix +# versions of dmake to use a provided version of getcwd rather than the +# standard library version that uses popen to capture the output of pwd. +# + +osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT) + +# The following are required sources +OSRESRC := getcwd.c + +.IF $(OSRESRC) + SRC += $(OSRESRC) + .SETDIR=$(osredir) : $(OSRESRC) +.END + +.SOURCE.h : $(osredir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osredir) diff --git a/dmake/unix/sysvr3/pwd/getcwd.c b/dmake/unix/sysvr3/pwd/getcwd.c new file mode 100644 index 000000000000..f2359bcc795b --- /dev/null +++ b/dmake/unix/sysvr3/pwd/getcwd.c @@ -0,0 +1,231 @@ +/* + getcwd -- get pathname of current working directory + + public-domain implementation + + last edit: 03-Nov-1990 Gwyn@BRL.MIL + + complies with the following standards: + IEEE Std 1003.1-1988 + SVID Issue 3 + X/Open Portability Guide Issue 2 (when "XPG2" is defined) + X/Open Portability Guide Issue 3 + + This implementation of getcwd() can be used to replace the UNIX + System V library routine (which uses popen() to capture the output of + the "pwd" command). Once that is done, "pwd" can be reimplemented as + just puts(getcwd((char*)0,0)), assuming "XPG2" is defined below. + + This implementation depends on every directory having entries for + "." and "..". It also depends on the internals of the <dirent.h> + data structures to some degree. + + I considered using chdir() to ascend the hierarchy, followed by a + final chdir() to the path being returned by getcwd() to restore the + location, but decided that error recovery was too difficult that way. + The algorithm I settled on was inspired by my rewrite of the "pwd" + utility, combined with the dotdots[] array trick from the SVR2 shell. +*/ +#define XPG2 /* define to support obsolete XPG2-mandated feature */ + + +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef M_XENIX +# include <sys/ndir.h> +# define dirent direct +#else +# include <dirent.h> +#endif + +#include <errno.h> +#include <string.h> + +typedef char *pointer; /* (void *) if you have it */ + +extern void free(); +extern pointer malloc(); +extern int fstat(), stat(); + +extern int errno; /* normally done by <errno.h> */ + +#ifndef NULL +#define NULL 0 /* amorphous null pointer constant */ +#endif + +#ifndef NAME_MAX +#define NAME_MAX 255 /* maximum directory entry size */ +#endif + + +char * +getcwd( buf, size ) /* returns pointer to CWD pathname */ + char *buf; /* where to put name (NULL to malloc) */ + int size; /* size of buf[] or malloc()ed memory */ + { + static char dotdots[] = +"../../../../../../../../../../../../../../../../../../../../../../../../../.."; + char *dotdot; /* -> dotdots[.], right to left */ + DIR *dirp; /* -> parent directory stream */ + struct dirent *dir; /* -> directory entry */ + struct stat stat1, + stat2; /* info from stat() */ + struct stat *d = &stat1; /* -> info about "." */ + struct stat *dd = &stat2; /* -> info about ".." */ + register char *buffer; /* local copy of buf, or malloc()ed */ + char *bufend; /* -> buffer[size] */ + register char *endp; /* -> end of reversed string */ + register char *dname; /* entry name ("" for root) */ + int serrno = errno; /* save entry errno */ + + if ( buf != NULL && size <= 0 +#ifndef XPG2 + || buf == NULL +#endif + ) { + errno = EINVAL; /* invalid argument */ + return NULL; + } + + buffer = buf; +#ifdef XPG2 + if ( buf == NULL /* wants us to malloc() the string */ + && (buffer = (char *) malloc( (unsigned) size )) == NULL + /* XXX -- actually should probably not pay attention to "size" arg */ + ) { + errno = ENOMEM; /* cannot malloc() specified size */ + return NULL; + } +#endif + + if ( stat( ".", dd ) != 0 ) /* prime the pump */ + goto error; /* errno already set */ + + endp = buffer; /* initially, empty string */ + bufend = &buffer[size]; + + for ( dotdot = &dotdots[sizeof dotdots]; dotdot != dotdots; ) + { + dotdot -= 3; /* include one more "/.." section */ + /* (first time is actually "..") */ + + /* swap stat() info buffers */ + { + register struct stat *temp = d; + + d = dd; /* new current dir is old parent dir */ + dd = temp; + } + + if ( (dirp = opendir( dotdot )) == NULL ) /* new parent */ + goto error; /* errno already set */ + + if ( fstat( dirp->dd_fd, dd ) != 0 ) + { + serrno = errno; /* set by fstat() */ + (void)closedir( dirp ); + errno = serrno; /* in case closedir() clobbered it */ + goto error; + } + + if ( d->st_dev == dd->st_dev ) + { /* not crossing a mount point */ + if ( d->st_ino == dd->st_ino ) + { /* root directory */ + dname = ""; + goto append; + } + + do + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + while ( dir->d_ino != d->st_ino ); + } + else { /* crossing a mount point */ + struct stat t; /* info re. test entry */ + char name[sizeof dotdots + 1 + NAME_MAX]; + + (void)strcpy( name, dotdot ); + dname = &name[strlen( name )]; + *dname++ = '/'; + + do { + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + + (void)strcpy( dname, dir->d_name ); + /* must fit if NAME_MAX is not a lie */ + } + while ( stat( name, &t ) != 0 + || t.st_ino != d->st_ino + || t.st_dev != d->st_dev + ); + } + + dname = dir->d_name; + + /* append "/" and reversed dname string onto buffer */ + append: + if ( endp != buffer /* avoid trailing / in final name */ + || dname[0] == '\0' /* but allow "/" when CWD is root */ + ) + *endp++ = '/'; + + { + register char *app; /* traverses dname string */ + + for ( app = dname; *app != '\0'; ++app ) + ; + + if ( app - dname >= bufend - endp ) + { + (void)closedir( dirp ); + errno = ERANGE; /* won't fit allotted space */ + goto error; + } + + while ( app != dname ) + *endp++ = *--app; + } + + (void)closedir( dirp ); + + if ( dname[0] == '\0' ) /* reached root; wrap it up */ + { + register char *startp; /* -> buffer[.] */ + + *endp = '\0'; /* plant null terminator */ + + /* straighten out reversed pathname string */ + for ( startp = buffer; --endp > startp; ++startp ) + { + char temp = *endp; + + *endp = *startp; + *startp = temp; + } + + errno = serrno; /* restore entry errno */ + /* XXX -- if buf==NULL, realloc here? */ + return buffer; + } + } + + errno = ENOMEM; /* actually, algorithm failure */ + + error: + if ( buf == NULL ) + free( (pointer)buffer ); + + return NULL; + } + diff --git a/dmake/unix/sysvr3/pwd/make.sh b/dmake/unix/sysvr3/pwd/make.sh new file mode 100644 index 000000000000..1f57569f61df --- /dev/null +++ b/dmake/unix/sysvr3/pwd/make.sh @@ -0,0 +1,62 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/sysvr3 -Iunix/sysvr3/pwd -O unix/sysvr3/pwd/getcwd.c +mv getcwd.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o objects/getcwd.o +cp unix/sysvr3/pwd/template.mk startup/config.mk diff --git a/dmake/unix/sysvr3/pwd/public.h b/dmake/unix/sysvr3/pwd/public.h new file mode 100644 index 000000000000..78ce5609988e --- /dev/null +++ b/dmake/unix/sysvr3/pwd/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:57:06 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/sysvr3/pwd/template.mk b/dmake/unix/sysvr3/pwd/template.mk new file mode 100644 index 000000000000..fa6b4aa6bd1b --- /dev/null +++ b/dmake/unix/sysvr3/pwd/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= sysvr3 + OSENVIRONMENT *:= pwd diff --git a/dmake/unix/sysvr3/stdlib.h b/dmake/unix/sysvr3/stdlib.h new file mode 100644 index 000000000000..077123d5494f --- /dev/null +++ b/dmake/unix/sysvr3/stdlib.h @@ -0,0 +1,55 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:35 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +#ifndef _AIX +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); + +/* The AIX compiler dies on illegal redefinition of free */ +extern free(); +#endif + +/* AIX doesn't use NAME_MAX anylonger... */ +#ifdef _AIX +#include <unistd.h> +#define NAME_MAX pathconf("/dev/null",_PC_NAME_MAX) +#endif + +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/sysvr3/template.mk b/dmake/unix/sysvr3/template.mk new file mode 100644 index 000000000000..3cb518671142 --- /dev/null +++ b/dmake/unix/sysvr3/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= sysvr3 + OSENVIRONMENT *:= diff --git a/dmake/unix/sysvr3/time.h b/dmake/unix/sysvr3/time.h new file mode 100644 index 000000000000..3b3dfac5684f --- /dev/null +++ b/dmake/unix/sysvr3/time.h @@ -0,0 +1,32 @@ +/* RCS $Id: time.h,v 1.1.1.1 2000-09-22 15:33:35 hr Exp $ +-- +-- SYNOPSIS +-- time_t +-- +-- DESCRIPTION +-- Properly define time_t. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef TIME_h +#define TIME_h + +typedef long time_t; /* this is the thing we use */ + +#endif TIME_h + diff --git a/dmake/unix/sysvr4/config.mk b/dmake/unix/sysvr4/config.mk new file mode 100644 index 000000000000..6443ff6a91c9 --- /dev/null +++ b/dmake/unix/sysvr4/config.mk @@ -0,0 +1,27 @@ +# This is the SysV R4 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/sysvr4/make.sh b/dmake/unix/sysvr4/make.sh new file mode 100644 index 000000000000..9ab5904422f0 --- /dev/null +++ b/dmake/unix/sysvr4/make.sh @@ -0,0 +1,60 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/sysvr4 -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/sysvr4 -O unix/dcache.c +mv dcache.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o +cp unix/sysvr4/template.mk startup/config.mk diff --git a/dmake/unix/sysvr4/public.h b/dmake/unix/sysvr4/public.h new file mode 100644 index 000000000000..d8929a0ea7e5 --- /dev/null +++ b/dmake/unix/sysvr4/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:57:19 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/sysvr4/template.mk b/dmake/unix/sysvr4/template.mk new file mode 100644 index 000000000000..553878268e59 --- /dev/null +++ b/dmake/unix/sysvr4/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= sysvr4 + OSENVIRONMENT *:= diff --git a/dmake/unix/tempnam.c b/dmake/unix/tempnam.c new file mode 100644 index 000000000000..4b143ed8d0d7 --- /dev/null +++ b/dmake/unix/tempnam.c @@ -0,0 +1,106 @@ +/* RCS $Id: tempnam.c,v 1.2 2002-07-11 08:53:35 mh Exp $ +-- +-- SYNOPSIS +-- tempnam +-- +-- DESCRIPTION +-- temp file name generation routines. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifdef __APPLE__ + +/*LINTLIBRARY*/ +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#if defined(max) +# undef max +#endif +#define max(A,B) (((A)<(B))?(B):(A)) + +extern char *mktemp(); +extern int access(); +int d_access(); + +char * +dtempnam(dir, prefix) +char *dir; /* use this directory please (if non-NULL) */ +char *prefix; /* use this (if non-NULL) as filename prefix */ +{ + static int count = 0; + register char *p, *q, *tmpdir; + int tl=0, dl=0, pl; + char buf[30]; + + pl = strlen(P_tmpdir); + + if( (tmpdir = getenv("TMPDIR")) != NULL ) tl = strlen(tmpdir); + else if( (tmpdir = getenv("TMP")) != NULL ) tl = strlen(tmpdir); + if( dir != NULL ) dl = strlen(dir); + + if( (p = malloc((unsigned)(max(max(dl,tl),pl)+13))) == NULL ) + return(NULL); + + *p = '\0'; + + if( (tl == 0) || (d_access( strcpy(p, tmpdir), 0) != 0) ) + if( (dl == 0) || (d_access( strcpy(p, dir), 0) != 0) ) + if( d_access( strcpy(p, P_tmpdir), 0) != 0 ) + if( !prefix ) + prefix = "tp"; + + if(prefix) + { + *(p+strlen(p)+2) = '\0'; + (void)strncat(p, prefix, 2); + } + + sprintf( buf, "%08x", getpid() ); + buf[6]='\0'; + (void)strcat(p, buf ); + sprintf( buf, "%04d", count++ ); + q=p+strlen(p)-6; + *q++ = buf[0]; *q++ = buf[1]; + *q++ = buf[2]; *q++ = buf[3]; + + if( (q = strrchr(p,'.')) != NULL ) *q = '\0'; + + return(p); +} + + + +d_access( name, flag ) +char *name; +int flag; +{ + extern char *DirSepStr; + char *p; + int r; + + if( name == NULL || !*name ) return(1); /* NULL dir means current dir */ + r = access( name, flag ); + p = name+strlen(name)-1; + if(*p != '/' && *p != '\\') strcat( p, DirSepStr ); + + return( r ); +} + +#endif diff --git a/dmake/unix/xenix/config.mk b/dmake/unix/xenix/config.mk new file mode 100644 index 000000000000..a4f8f78f3ee1 --- /dev/null +++ b/dmake/unix/xenix/config.mk @@ -0,0 +1,27 @@ +# This is the SysV R3 UNIX configuration file for DMAKE +# It simply modifies the values of SRC, and checks to see if +# OSENVIRONMENT is defined. If so it includes the appropriate +# config.mk file. +# +# It also sets the values of .SOURCE.c and .SOURCE.h to include the local +# directory. +# +osrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE) + +# The following are required sources +OSDSRC := +.IF $(OSDSRC) + SRC += $(OSDSRC) + .SETDIR=$(osrdir) : $(OSDSRC) +.END + +.SOURCE.h : $(osrdir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osrdir) -DM_XENIX + +# See if we modify anything in the lower levels. +.IF $(OSENVIRONMENT) != $(NULL) + .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk +.END diff --git a/dmake/unix/xenix/make.sh b/dmake/unix/xenix/make.sh new file mode 100644 index 000000000000..597936f38061 --- /dev/null +++ b/dmake/unix/xenix/make.sh @@ -0,0 +1,60 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -O unix/dcache.c +mv dcache.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o +cp unix/xenix/template.mk startup/config.mk diff --git a/dmake/unix/xenix/public.h b/dmake/unix/xenix/public.h new file mode 100644 index 000000000000..7c24a76b9a0b --- /dev/null +++ b/dmake/unix/xenix/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:57:31 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/xenix/pwd/config.mk b/dmake/unix/xenix/pwd/config.mk new file mode 100644 index 000000000000..095ff3587a68 --- /dev/null +++ b/dmake/unix/xenix/pwd/config.mk @@ -0,0 +1,23 @@ +# This is the Sys VR3 PWD configuration file. It configures SysvR3 unix +# versions of dmake to use a provided version of getcwd rather than the +# standard library version that uses popen to capture the output of pwd. +# + +osredir := $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)$(OSENVIRONMENT) + +# The following are required sources +OSRESRC := getcwd.c + +.IF $(OSRESRC) + SRC += $(OSRESRC) + .SETDIR=$(osredir) : $(OSRESRC) +.END + +.SOURCE.h : $(osredir) + +# Local configuration modifications for CFLAGS, there's local SysV includes +# too. +CFLAGS += -I$(osredir) + +# Xenix needs -lx in order to link successfully. +LDLIBS += -lx diff --git a/dmake/unix/xenix/pwd/getcwd.c b/dmake/unix/xenix/pwd/getcwd.c new file mode 100644 index 000000000000..f2359bcc795b --- /dev/null +++ b/dmake/unix/xenix/pwd/getcwd.c @@ -0,0 +1,231 @@ +/* + getcwd -- get pathname of current working directory + + public-domain implementation + + last edit: 03-Nov-1990 Gwyn@BRL.MIL + + complies with the following standards: + IEEE Std 1003.1-1988 + SVID Issue 3 + X/Open Portability Guide Issue 2 (when "XPG2" is defined) + X/Open Portability Guide Issue 3 + + This implementation of getcwd() can be used to replace the UNIX + System V library routine (which uses popen() to capture the output of + the "pwd" command). Once that is done, "pwd" can be reimplemented as + just puts(getcwd((char*)0,0)), assuming "XPG2" is defined below. + + This implementation depends on every directory having entries for + "." and "..". It also depends on the internals of the <dirent.h> + data structures to some degree. + + I considered using chdir() to ascend the hierarchy, followed by a + final chdir() to the path being returned by getcwd() to restore the + location, but decided that error recovery was too difficult that way. + The algorithm I settled on was inspired by my rewrite of the "pwd" + utility, combined with the dotdots[] array trick from the SVR2 shell. +*/ +#define XPG2 /* define to support obsolete XPG2-mandated feature */ + + +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef M_XENIX +# include <sys/ndir.h> +# define dirent direct +#else +# include <dirent.h> +#endif + +#include <errno.h> +#include <string.h> + +typedef char *pointer; /* (void *) if you have it */ + +extern void free(); +extern pointer malloc(); +extern int fstat(), stat(); + +extern int errno; /* normally done by <errno.h> */ + +#ifndef NULL +#define NULL 0 /* amorphous null pointer constant */ +#endif + +#ifndef NAME_MAX +#define NAME_MAX 255 /* maximum directory entry size */ +#endif + + +char * +getcwd( buf, size ) /* returns pointer to CWD pathname */ + char *buf; /* where to put name (NULL to malloc) */ + int size; /* size of buf[] or malloc()ed memory */ + { + static char dotdots[] = +"../../../../../../../../../../../../../../../../../../../../../../../../../.."; + char *dotdot; /* -> dotdots[.], right to left */ + DIR *dirp; /* -> parent directory stream */ + struct dirent *dir; /* -> directory entry */ + struct stat stat1, + stat2; /* info from stat() */ + struct stat *d = &stat1; /* -> info about "." */ + struct stat *dd = &stat2; /* -> info about ".." */ + register char *buffer; /* local copy of buf, or malloc()ed */ + char *bufend; /* -> buffer[size] */ + register char *endp; /* -> end of reversed string */ + register char *dname; /* entry name ("" for root) */ + int serrno = errno; /* save entry errno */ + + if ( buf != NULL && size <= 0 +#ifndef XPG2 + || buf == NULL +#endif + ) { + errno = EINVAL; /* invalid argument */ + return NULL; + } + + buffer = buf; +#ifdef XPG2 + if ( buf == NULL /* wants us to malloc() the string */ + && (buffer = (char *) malloc( (unsigned) size )) == NULL + /* XXX -- actually should probably not pay attention to "size" arg */ + ) { + errno = ENOMEM; /* cannot malloc() specified size */ + return NULL; + } +#endif + + if ( stat( ".", dd ) != 0 ) /* prime the pump */ + goto error; /* errno already set */ + + endp = buffer; /* initially, empty string */ + bufend = &buffer[size]; + + for ( dotdot = &dotdots[sizeof dotdots]; dotdot != dotdots; ) + { + dotdot -= 3; /* include one more "/.." section */ + /* (first time is actually "..") */ + + /* swap stat() info buffers */ + { + register struct stat *temp = d; + + d = dd; /* new current dir is old parent dir */ + dd = temp; + } + + if ( (dirp = opendir( dotdot )) == NULL ) /* new parent */ + goto error; /* errno already set */ + + if ( fstat( dirp->dd_fd, dd ) != 0 ) + { + serrno = errno; /* set by fstat() */ + (void)closedir( dirp ); + errno = serrno; /* in case closedir() clobbered it */ + goto error; + } + + if ( d->st_dev == dd->st_dev ) + { /* not crossing a mount point */ + if ( d->st_ino == dd->st_ino ) + { /* root directory */ + dname = ""; + goto append; + } + + do + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + while ( dir->d_ino != d->st_ino ); + } + else { /* crossing a mount point */ + struct stat t; /* info re. test entry */ + char name[sizeof dotdots + 1 + NAME_MAX]; + + (void)strcpy( name, dotdot ); + dname = &name[strlen( name )]; + *dname++ = '/'; + + do { + if ( (dir = readdir( dirp )) == NULL ) + { + (void)closedir( dirp ); + errno = ENOENT; /* missing entry */ + goto error; + } + + (void)strcpy( dname, dir->d_name ); + /* must fit if NAME_MAX is not a lie */ + } + while ( stat( name, &t ) != 0 + || t.st_ino != d->st_ino + || t.st_dev != d->st_dev + ); + } + + dname = dir->d_name; + + /* append "/" and reversed dname string onto buffer */ + append: + if ( endp != buffer /* avoid trailing / in final name */ + || dname[0] == '\0' /* but allow "/" when CWD is root */ + ) + *endp++ = '/'; + + { + register char *app; /* traverses dname string */ + + for ( app = dname; *app != '\0'; ++app ) + ; + + if ( app - dname >= bufend - endp ) + { + (void)closedir( dirp ); + errno = ERANGE; /* won't fit allotted space */ + goto error; + } + + while ( app != dname ) + *endp++ = *--app; + } + + (void)closedir( dirp ); + + if ( dname[0] == '\0' ) /* reached root; wrap it up */ + { + register char *startp; /* -> buffer[.] */ + + *endp = '\0'; /* plant null terminator */ + + /* straighten out reversed pathname string */ + for ( startp = buffer; --endp > startp; ++startp ) + { + char temp = *endp; + + *endp = *startp; + *startp = temp; + } + + errno = serrno; /* restore entry errno */ + /* XXX -- if buf==NULL, realloc here? */ + return buffer; + } + } + + errno = ENOMEM; /* actually, algorithm failure */ + + error: + if ( buf == NULL ) + free( (pointer)buffer ); + + return NULL; + } + diff --git a/dmake/unix/xenix/pwd/make.sh b/dmake/unix/xenix/pwd/make.sh new file mode 100644 index 000000000000..e7c02e53ace6 --- /dev/null +++ b/dmake/unix/xenix/pwd/make.sh @@ -0,0 +1,62 @@ +mkdir objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O infer.c +mv infer.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O make.c +mv make.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O stat.c +mv stat.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O expand.c +mv expand.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O dmstring.c +mv dmstring.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O hash.c +mv hash.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O dag.c +mv dag.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O dmake.c +mv dmake.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O path.c +mv path.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O imacs.c +mv imacs.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O sysintf.c +mv sysintf.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O parse.c +mv parse.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O getinp.c +mv getinp.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O quit.c +mv quit.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O state.c +mv state.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O dmdump.c +mv dmdump.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O macparse.c +mv macparse.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O rulparse.c +mv rulparse.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O percent.c +mv percent.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O function.c +mv function.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/arlib.c +mv arlib.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/dirbrk.c +mv dirbrk.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/rmprq.c +mv rmprq.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/ruletab.c +mv ruletab.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/runargv.c +mv runargv.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/dcache.c +mv dcache.o objects +cc -c -I. -Iunix -Iunix/xenix -DM_XENIX -Iunix/xenix/pwd -O unix/xenix/pwd/getcwd.c +mv getcwd.o objects +cc -O -o dmake objects/infer.o objects/make.o objects/stat.o objects/expand.o \ +objects/dmstring.o objects/hash.o objects/dag.o objects/dmake.o objects/path.o \ +objects/imacs.o objects/sysintf.o objects/parse.o objects/getinp.o \ +objects/quit.o objects/state.o objects/dmdump.o objects/macparse.o \ +objects/rulparse.o objects/percent.o objects/function.o objects/arlib.o \ +objects/dirbrk.o objects/rmprq.o objects/ruletab.o objects/runargv.o objects/dcache.o objects/getcwd.o -lx +cp unix/xenix/pwd/template.mk startup/config.mk diff --git a/dmake/unix/xenix/pwd/public.h b/dmake/unix/xenix/pwd/public.h new file mode 100644 index 000000000000..593e2956b3e1 --- /dev/null +++ b/dmake/unix/xenix/pwd/public.h @@ -0,0 +1,167 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:57:43 ihi Exp $ +-- WARNING -- This file is AUTOMATICALLY GENERATED DO NOT EDIT IT +-- +-- +-- SYNOPSIS +-- Local functions exported to be visible by others. +-- +-- DESCRIPTION +-- This file is generated by 'genpub'. Function declarations +-- that appear in this file are extracted by 'genpub' from +-- source files. Any function in the source file whose definition +-- appears like: +-- +-- PUBLIC return_type +-- function( arg_list ); +-- type_expr1 arg1; +-- ... +-- +-- has its definition extracted and a line of the form: +-- +-- return_type function ANSI((type_expr1,type_expr2,...)); +-- +-- entered into the output file. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef _DMAKE_PUBLIC_h +#define _DMAKE_PUBLIC_h + +#ifdef EXTERN +#undef EXTERN +#endif +#if defined(DEFINE_DMAKE_VARIABLES) +#define EXTERN +#else +#define EXTERN extern +#endif + +/***** genpub: Begin list of generated function headers */ +void Infer_recipe ANSI((CELLPTR, CELLPTR)); +int Make_targets ANSI(()); +int Make ANSI((CELLPTR, CELLPTR)); +int Exec_commands ANSI((CELLPTR)); +void Print_cmnd ANSI((char *, int, int)); +int Push_dir ANSI((char *, char *, int)); +void Pop_dir ANSI((int)); +void Append_line ANSI((char *, int, FILE *, char *, int, int)); +void Stat_target ANSI((CELLPTR, int, int)); +char *Expand ANSI((char *)); +char *Apply_edit ANSI((char *, char *, char *, int, int)); +void Map_esc ANSI((char *)); +char* Apply_modifiers ANSI((int, char *)); +char* Tokenize ANSI((char *, char *, char, int)); +char* ScanToken ANSI((char *, char **, int)); +char *DmStrJoin ANSI((char *, char *, int, int)); +char *DmStrAdd ANSI((char *, char *, int)); +char *DmStrApp ANSI((char *, char *)); +char *DmStrDup ANSI((char *)); +char *DmStrDup2 ANSI((char *)); +char *DmStrPbrk ANSI((char *, char *)); +char *DmStrSpn ANSI((char *, char *)); +char *DmStrStr ANSI((char *, char *)); +char *DmSubStr ANSI((char *, char *)); +uint16 Hash ANSI((char *, uint32 *)); +HASHPTR Get_name ANSI((char *, HASHPTR *, int)); +HASHPTR Search_table ANSI((HASHPTR *, char *, uint16 *, uint32 *)); +HASHPTR Push_macro ANSI((HASHPTR)); +HASHPTR Pop_macro ANSI((HASHPTR)); +HASHPTR Def_macro ANSI((char *, char *, int)); +CELLPTR Def_cell ANSI((char *)); +LINKPTR Add_prerequisite ANSI((CELLPTR, CELLPTR, int, int)); +void Clear_prerequisites ANSI((CELLPTR)); +int Test_circle ANSI((CELLPTR, int)); +STRINGPTR Def_recipe ANSI((char *, STRINGPTR, int, int)); +t_attr Rcp_attribute ANSI((char *)); +int main ANSI((int, char **)); +FILE *Openfile ANSI((char *, int, int)); +FILE *Closefile ANSI(()); +FILE *Search_file ANSI((char *, char **)); +char *Filename ANSI(()); +int Nestlevel ANSI(()); +FILE *TryFiles ANSI((LINKPTR)); +void Fatal ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Error ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void Warning ANSI((ARG (char *,fmt),ARG (va_alist_type, va_alist))); +void No_ram ANSI(()); +void Usage ANSI((int)); +void Version ANSI(()); +char *Get_suffix ANSI((char *)); +char *Basename ANSI((char *)); +char *Filedir ANSI((char *)); +char *Build_path ANSI((char *, char *)); +void Make_rules ANSI(()); +void Create_macro_vars ANSI(()); +time_t Do_stat ANSI((char *, char *, char **, int)); +int Do_touch ANSI((char *, char *, char **)); +void Void_lib_cache ANSI((char *, char *)); +time_t Do_time ANSI(()); +void Do_profile_output ANSI((char *, uint16, CELLPTR)); +int Do_cmnd ANSI((char **, int, int, CELLPTR, t_attr, int)); +char ** Pack_argv ANSI((int, int, char **)); +char *Read_env_string ANSI((char *)); +int Write_env_string ANSI((char *, char *)); +void ReadEnvironment ANSI(()); +void Catch_signals ANSI((void (*)(int))); +void Clear_signals ANSI(()); +void Prolog ANSI((int, char* [])); +void Epilog ANSI((int)); +char *Get_current_dir ANSI(()); +int Set_dir ANSI((char*)); +char Get_switch_char ANSI(()); +FILE* Get_temp ANSI((char **, char *)); +FILE *Start_temp ANSI((char *, CELLPTR, char **)); +void Open_temp_error ANSI((char *, char *)); +void Link_temp ANSI((CELLPTR, FILE *, char *)); +void Close_temp ANSI((CELLPTR, FILE *)); +void Unlink_temp_files ANSI((CELLPTR)); +void Handle_result ANSI((int, int, int, CELLPTR)); +void Update_time_stamp ANSI((CELLPTR)); +int Remove_file ANSI((char *)); +void Parse ANSI((FILE *)); +int Get_line ANSI((char *, FILE *)); +char *Do_comment ANSI((char *, char **, int)); +char *Get_token ANSI((TKSTRPTR, char *, int)); +void Quit ANSI((int)); +void Read_state ANSI(()); +void Write_state ANSI(()); +int Check_state ANSI((CELLPTR, STRINGPTR *, int)); +void Dump ANSI(()); +void Dump_recipe ANSI((STRINGPTR)); +int Parse_macro ANSI((char *, int)); +int Macro_op ANSI((char *)); +int Parse_rule_def ANSI((int *)); +int Rule_op ANSI((char *)); +void Add_recipe_to_list ANSI((char *, int, int)); +void Bind_rules_to_targets ANSI((int)); +int Set_group_attributes ANSI((char *)); +DFALINKPTR Match_dfa ANSI((char *)); +void Check_circle_dfa ANSI(()); +void Add_nfa ANSI((char *)); +char *Exec_function ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); +int If_root_path ANSI((char *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +int Wait_for_child ANSI((int, int)); +void Clean_up_processes ANSI(()); +time_t CacheStat ANSI((char *, int)); + +#endif diff --git a/dmake/unix/xenix/pwd/template.mk b/dmake/unix/xenix/pwd/template.mk new file mode 100644 index 000000000000..abd4066c347b --- /dev/null +++ b/dmake/unix/xenix/pwd/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= xenix + OSENVIRONMENT *:= pwd diff --git a/dmake/unix/xenix/stdlib.h b/dmake/unix/xenix/stdlib.h new file mode 100644 index 000000000000..fe814c798a0b --- /dev/null +++ b/dmake/unix/xenix/stdlib.h @@ -0,0 +1,50 @@ +/* RCS $Id: stdlib.h,v 1.1.1.1 2000-09-22 15:33:36 hr Exp $ +-- +-- SYNOPSIS +-- stdlib interface +-- +-- DESCRIPTION +-- Specially needed pieces of interface to the standard C lib. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + + +#ifndef _STDLIB_INCLUDED_ +#define _STDLIB_INCLUDED_ + +extern /*GOTO*/ _exit(); +extern /*GOTO*/ exit(); +extern /*GOTO*/ abort(); +extern int system(); +extern char *getenv(); +extern char *calloc(); +extern char *malloc(); +extern char *realloc(); + +#ifndef _AIX +/* The AIX compiler dies on illegal redefinition of free */ +extern free(); +#endif + +extern int errno; + +#ifndef EIO +# include <errno.h> +#endif + +#endif /* _STDLIB_INCLUDED_ */ diff --git a/dmake/unix/xenix/template.mk b/dmake/unix/xenix/template.mk new file mode 100644 index 000000000000..7ab223fbdb9f --- /dev/null +++ b/dmake/unix/xenix/template.mk @@ -0,0 +1,7 @@ +# ** Default build configuration for dmake. +# ** DO NOT PLACE LOCAL DEFINITIONS INTO THIS FILE IT IS AUTO GENERATED +# ** USE "startup/local.mk" for those. + + OS *:= unix + OSRELEASE *:= xenix + OSENVIRONMENT *:= diff --git a/dmake/unix/xenix/time.h b/dmake/unix/xenix/time.h new file mode 100644 index 000000000000..c7102cfc18cb --- /dev/null +++ b/dmake/unix/xenix/time.h @@ -0,0 +1,32 @@ +/* RCS $Id: time.h,v 1.1.1.1 2000-09-22 15:33:36 hr Exp $ +-- +-- SYNOPSIS +-- time_t +-- +-- DESCRIPTION +-- Properly define time_t. +-- +-- AUTHOR +-- Dennis Vadura, dvadura@dmake.wticorp.com +-- +-- WWW +-- http://dmake.wticorp.com/ +-- +-- COPYRIGHT +-- Copyright (c) 1996,1997 by WTI Corp. All rights reserved. +-- +-- This program is NOT free software; you can redistribute it and/or +-- modify it under the terms of the Software License Agreement Provided +-- in the file <distribution-root>/readme/license.txt. +-- +-- LOG +-- Use cvs log to obtain detailed change logs. +*/ + +#ifndef TIME_h +#define TIME_h + +typedef long time_t; /* this is the thing we use */ + +#endif TIME_h + |