diff options
Diffstat (limited to 'dmake/tos')
-rw-r--r-- | dmake/tos/config.mk | 49 | ||||
-rw-r--r-- | dmake/tos/make.sh | 57 | ||||
-rw-r--r-- | dmake/tos/public.h | 166 | ||||
-rw-r--r-- | dmake/tos/putenv.c | 78 | ||||
-rw-r--r-- | dmake/tos/ruletab.c | 42 | ||||
-rw-r--r-- | dmake/tos/startup.h | 28 | ||||
-rw-r--r-- | dmake/tos/sysintf.h | 45 | ||||
-rw-r--r-- | dmake/tos/template.mk | 7 | ||||
-rw-r--r-- | dmake/tos/tempnam.c | 104 |
9 files changed, 576 insertions, 0 deletions
diff --git a/dmake/tos/config.mk b/dmake/tos/config.mk new file mode 100644 index 000000000000..65076200175a --- /dev/null +++ b/dmake/tos/config.mk @@ -0,0 +1,49 @@ +# 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 $@ $(OBJDIR)/*$O +LDFLAGS += -s +LD = $(CC) + +# Debug flags +DB_CFLAGS = -g -DDBUG +DB_LDFLAGS = -g +DB_LDLIBS = + +# NO Debug flags +NDB_CFLAGS = -O +NDB_LDFLAGS = +NDB_LDLIBS = + +# Local configuration modifications for CFLAGS. +CFLAGS += -I$(OS) + +# Sources that must be defined for each different version +OS_SRC += ruletab.c +DOS_SRC = rmprq.c runargv.c dirbrk.c rmprq.c +UNIX_SRC = arlib.c +BSD_SRC = putenv.c tempnam.c + +.SETDIR=$(OS) : $(OS_SRC) +.SETDIR=msdos : $(DOS_SRC) +.SETDIR=unix : $(UNIX_SRC) +.SETDIR=unix/bsd43 : $(BSD_SRC) + +SRC += $(OS_SRC) $(DOS_SRC) $(UNIX_SRC) $(BSD_SRC) + +# 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/tos/make.sh b/dmake/tos/make.sh new file mode 100644 index 000000000000..8ecb7db9c8e3 --- /dev/null +++ b/dmake/tos/make.sh @@ -0,0 +1,57 @@ +mkdir objects +gcc -c -I. -Itos -O infer.c +mv infer.o objects +gcc -c -I. -Itos -O make.c +mv make.o objects +gcc -c -I. -Itos -O stat.c +mv stat.o objects +gcc -c -I. -Itos -O expand.c +mv expand.o objects +gcc -c -I. -Itos -O dmstring.c +mv dmstring.o objects +gcc -c -I. -Itos -O hash.c +mv hash.o objects +gcc -c -I. -Itos -O dag.c +mv dag.o objects +gcc -c -I. -Itos -O dmake.c +mv dmake.o objects +gcc -c -I. -Itos -O path.c +mv path.o objects +gcc -c -I. -Itos -O imacs.c +mv imacs.o objects +gcc -c -I. -Itos -O sysintf.c +mv sysintf.o objects +gcc -c -I. -Itos -O parse.c +mv parse.o objects +gcc -c -I. -Itos -O getinp.c +mv getinp.o objects +gcc -c -I. -Itos -O quit.c +mv quit.o objects +gcc -c -I. -Itos -O state.c +mv state.o objects +gcc -c -I. -Itos -O dmdump.c +mv dmdump.o objects +gcc -c -I. -Itos -O macparse.c +mv macparse.o objects +gcc -c -I. -Itos -O rulparse.c +mv rulparse.o objects +gcc -c -I. -Itos -O percent.c +mv percent.o objects +gcc -c -I. -Itos -O function.c +mv function.o objects +gcc -c -I. -Itos -O tos/ruletab.c +mv ruletab.o objects +gcc -c -I. -Itos -O msdos/rmprq.c +mv rmprq.o objects +gcc -c -I. -Itos -O msdos/runargv.c +mv runargv.o objects +gcc -c -I. -Itos -O msdos/dirbrk.c +mv dirbrk.o objects +gcc -c -I. -Itos -O unix/arlib.c +mv arlib.o objects +gcc -c -I. -Itos -O unix/bsd43/putenv.c +mv putenv.o objects +gcc -c -I. -Itos -O unix/bsd43/tempnam.c +mv tempnam.o objects +gcc -s -o dmake objects/*.o +cp tos/template.mk startup/config.mk diff --git a/dmake/tos/public.h b/dmake/tos/public.h new file mode 100644 index 000000000000..4b2f0af5e8f7 --- /dev/null +++ b/dmake/tos/public.h @@ -0,0 +1,166 @@ +/* RCS $Id: public.h,v 1.9 2007-10-15 15:52:34 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 *)); +void Remove_prq ANSI((CELLPTR)); +int runargv ANSI((CELLPTR, int, int, t_attr, char **)); +void Clean_up_processes ANSI(()); +int Wait_for_child ANSI((int, int)); +int If_root_path ANSI((char *)); +time_t seek_arch ANSI((char *, char *)); +int touch_arch ANSI(( char *, char *)); +void void_lcache ANSI(( char *, char *)); + +#endif diff --git a/dmake/tos/putenv.c b/dmake/tos/putenv.c new file mode 100644 index 000000000000..06e914d1fa0f --- /dev/null +++ b/dmake/tos/putenv.c @@ -0,0 +1,78 @@ +/* RCS $Id: putenv.c,v 1.1.1.1 2000-09-22 15:33:33 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/tos/ruletab.c b/dmake/tos/ruletab.c new file mode 100644 index 000000000000..2631131a8d7a --- /dev/null +++ b/dmake/tos/ruletab.c @@ -0,0 +1,42 @@ +/* RCS $Id: ruletab.c,v 1.2 2006-04-20 12:18:01 hr Exp $ +-- +-- 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 := 1", + "MAXPROCESS := 1", + "MAXLINELENGTH := 8190", + ".IMPORT .IGNORE: ROOTDIR 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/tos/startup.h b/dmake/tos/startup.h new file mode 100644 index 000000000000..30a91342c718 --- /dev/null +++ b/dmake/tos/startup.h @@ -0,0 +1,28 @@ +/* RCS $Id: startup.h,v 1.2 2006-04-20 12:18:14 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. +*/ + +"DMAKEROOT *:= $(ROOTDIR)/etc/startup", +"MAKESTARTUP := $(DMAKEROOT)/startup.mk", diff --git a/dmake/tos/sysintf.h b/dmake/tos/sysintf.h new file mode 100644 index 000000000000..da9974365c11 --- /dev/null +++ b/dmake/tos/sysintf.h @@ -0,0 +1,45 @@ +/* RCS $Id: sysintf.h,v 1.2 2007-01-18 09:43:39 vg 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() + +/* for directory cache */ +#define CacheStat(A,B) really_dostat(A,&buf) + +/* +** standard C items +*/ + +/* +** DOS interface standard items +*/ +#define getswitchar() '-' + +/* +** make parameters +*/ diff --git a/dmake/tos/template.mk b/dmake/tos/template.mk new file mode 100644 index 000000000000..91ce656f14b0 --- /dev/null +++ b/dmake/tos/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 *:= tos + OSRELEASE *:= + OSENVIRONMENT *:= diff --git a/dmake/tos/tempnam.c b/dmake/tos/tempnam.c new file mode 100644 index 000000000000..8c0e3077d65a --- /dev/null +++ b/dmake/tos/tempnam.c @@ -0,0 +1,104 @@ +/* RCS $Id: tempnam.c,v 1.1.1.1 2000-09-22 15:33:33 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="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); +} |