home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume14 / dmake / part01 next >
Encoding:
Text File  |  1990-07-26  |  39.5 KB  |  1,357 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v14i011: dmake version 3.5 part 1/21
  3. From: dvadura@watdragon.waterloo.edu (Dennis Vadura)
  4. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5.  
  6. Posting-number: Volume 14, Issue 11
  7. Submitted-by: dvadura@watdragon.waterloo.edu (Dennis Vadura)
  8. Archive-name: dmake/part01
  9.  
  10. #!/bin/sh
  11. # shar:    Shell Archiver  (v1.22)
  12. #
  13. # This is part 1 of a multipart archive                                    
  14. # do not concatenate these parts, unpack them in order with /bin/sh        
  15. #
  16. #    Run the following text with /bin/sh to create:
  17. #      vextern.h
  18. #      version.h
  19. #      unix
  20. #      unix/sysvr3
  21. #      unix/sysvr3/time.h
  22. #      unix/sysvr3/stdlib.h
  23. #      unix/sysvr3/stdarg.h
  24. #      unix/sysvr3/startup.mk
  25. #      unix/sysvr3/make.sh
  26. #      unix/sysvr3/config.mk
  27. #      unix/sysvr3/config.h
  28. #      unix/sysintf.h
  29. #      unix/startup.h
  30. #      unix/runargv.c
  31. #      unix/ruletab.c
  32. #      unix/rmprq.c
  33. #      unix/explode.c
  34. #      unix/dirbrk.c
  35. #      unix/config.mk
  36. #      unix/bsd43
  37. #      unix/bsd43/uw
  38. #      unix/bsd43/uw/startup.mk
  39. #      unix/bsd43/uw/make.sh
  40. #      unix/bsd43/uw/config.mk
  41. #      unix/bsd43/utime.c
  42. #      unix/bsd43/tempnam.c
  43. #      unix/bsd43/string.h
  44. #      unix/bsd43/stdlib.h
  45. #      unix/bsd43/stdarg.h
  46. #      unix/bsd43/startup.mk
  47. #      unix/bsd43/setvbuf.c
  48. #      unix/bsd43/putenv.c
  49. #      unix/bsd43/make.sh
  50. #      unix/bsd43/dynix
  51. #      unix/bsd43/dynix/startup.mk
  52. #      unix/bsd43/dynix/make.sh
  53. #      unix/bsd43/dynix/ctype.h
  54. #      unix/bsd43/dynix/config.mk
  55. #      unix/bsd43/config.mk
  56. #      unix/bsd43/config.h
  57. #      unix/arlib.c
  58. #      unix/386ix
  59. #      unix/386ix/time.h
  60. #      unix/386ix/stdlib.h
  61. #      unix/386ix/stdarg.h
  62. #      unix/386ix/startup.mk
  63. #      unix/386ix/make.sh
  64. #      unix/386ix/config.mk
  65. #      unix/386ix/config.h
  66. #      unix/386ix/ar.h
  67. #      sysintf.c
  68. #      struct.h
  69. #      string.c
  70. #      stat.c
  71. #      rulparse.c
  72. #      quit.c
  73. #      percent.c
  74. #      path.c
  75. #      patchlvl.h
  76. #      parse.c
  77. #      msdos
  78. #      msdos/tccdos
  79. #      msdos/tccdos/utime.c
  80. #      msdos/tccdos/tempnam.c
  81. #      msdos/tccdos/tccobj.rsp
  82. #      msdos/tccdos/tcclib.rsp
  83. #      msdos/tccdos/tcc.rsp
  84. #      msdos/tccdos/startup.mk
  85. #      msdos/tccdos/make.bat
  86. #      msdos/tccdos/config.mk
  87. #      msdos/tccdos/config.h
  88. #      msdos/sysintf.h
  89. #      msdos/switchar.c
  90. #      msdos/stdarg.h
  91. #      msdos/startup.h
  92. #      msdos/runargv.c
  93. #      msdos/ruletab.c
  94. #      msdos/rmprq.c
  95. #      msdos/mscdos
  96. #      msdos/mscdos/tempnam.c
  97. #      msdos/mscdos/startup.mk
  98. #      msdos/mscdos/mscobj.rsp
  99. #      msdos/mscdos/msclib.rsp
  100. #      msdos/mscdos/make.bat
  101. #      msdos/mscdos/config.mk
  102. #      msdos/mscdos/config.h
  103. #      msdos/dirbrk.c
  104. #      msdos/config.mk
  105. #      msdos/arlib.c
  106. #      msdos/_chdir.c
  107. #      man
  108. #      man/dmake.tf
  109. #      man/dmake.p
  110. #      man/dmake.nc
  111. #      makefile
  112. #      makefile.mk
  113. #      make.c
  114. #      make.bat
  115. #      macparse.c
  116. #      infer.c
  117. #      imacs.c
  118. #      hash.c
  119. #      getinp.c
  120. #      extern.h
  121. #      expand.c
  122. #      dump.c
  123. #      dmake.h
  124. #      dmake.c
  125. #      dag.c
  126. #      common
  127. #      common/print.mk
  128. #      common/malloc.c
  129. #      common/macros.h
  130. #      common/itypes.h
  131. #      common/dbug.h
  132. #      common/dbug.c
  133. #      common/db.h
  134. #      common/alloc.h
  135. #      basename.c
  136. #      _updctl
  137. #      _todo
  138. #      _readme
  139. #      _readme.dos
  140. #      _install
  141. #      LICENSE
  142. #
  143. if test -r s2_seq_.tmp
  144. then echo "Must unpack archives in sequence!"
  145.      next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
  146.      exit 1; fi
  147. echo "x - extracting vextern.h (Text)"
  148. sed 's/^X//' << 'SHAR_EOF' > vextern.h &&
  149. X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/RCS/vextern.h,v 1.1 90/07/19 13:55:39 dvadura Exp $
  150. X-- SYNOPSIS -- global variable declarations.
  151. X-- 
  152. X-- DESCRIPTION
  153. X--     Leave _DEFINE_GLOBALS_ undefined and the following declarations
  154. X--    will be defined as global variables, otherwise you get the
  155. X--    external declarations to the same global variables.
  156. X--
  157. X-- AUTHOR
  158. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  159. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  160. X--
  161. X-- COPYRIGHT
  162. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  163. X-- 
  164. X--      This program is free software; you can redistribute it and/or
  165. X--      modify it under the terms of the GNU General Public License
  166. X--      (version 1), as published by the Free Software Foundation, and
  167. X--      found in the file 'LICENSE' included with this distribution.
  168. X-- 
  169. X--      This program is distributed in the hope that it will be useful,
  170. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  171. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  172. X--      GNU General Public License for more details.
  173. X-- 
  174. X--      You should have received a copy of the GNU General Public License
  175. X--      along with this program;  if not, write to the Free Software
  176. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  177. X--
  178. X-- LOG
  179. X--     $Log:    vextern.h,v $
  180. X * Revision 1.1  90/07/19  13:55:39  dvadura
  181. X * Initial Revision of Version 3.5
  182. X * 
  183. X*/
  184. X#include <stdio.h>
  185. X#include "macros.h"
  186. X#include "struct.h"
  187. X#include "dmake.h"
  188. X
  189. X/* These two are defined in dir/ruletab.c and dir/dirbrk.c, and are always
  190. X * imported as externals by the other code.  Their defining modules do not
  191. X * #include this file. */
  192. Xextern    char*    DirBrkStr;    /* pointer to value of macro DIRBRKSTR    */
  193. Xextern    char**    Rule_tab;    /* Builtin rules */
  194. X
  195. X#ifndef _DEFINE_GLOBALS_
  196. X#define EXTERN    extern
  197. X#else
  198. X#define EXTERN
  199. X#endif
  200. X
  201. XEXTERN    int    Line_number;    /* Current line number in make file parse */
  202. XEXTERN    uint16    Glob_attr;    /* Global attrs to control global ops     */
  203. XEXTERN    char*    Prep;        /* Value of macro PREP              */
  204. XEXTERN    char*    Makedir;    /* pointer to macro value for MAKEDIR     */
  205. XEXTERN    CELL     Start_dir;    /* cell for   macro value for .SETDIR      */
  206. XEXTERN    char*    Shell;        /* pointer to macro value for SHELL       */
  207. XEXTERN    char*    Shell_flags;    /* pointer to macro value for SHELLFLAGS  */
  208. XEXTERN    char*    GShell;        /* pointer to macro value for GROUPSHELL  */
  209. XEXTERN    char*    GShell_flags;    /* pointer to macro value for GROUPFLAGS  */
  210. XEXTERN    char*    Shell_metas;    /* pointer to macro value for SHELLMETAS  */
  211. XEXTERN    char*    Grp_suff;    /* pointer to macro value for GROUPSUFFIX */
  212. XEXTERN  char*   DirSepStr;    /* pointer to macro value for DIRSEPSTR   */
  213. XEXTERN    char*    Pname;        /* dmake process invoke name              */
  214. XEXTERN    char*    Pwd;        /* current working dir, value of PWD      */
  215. XEXTERN    char*    Augmake;    /* -A */
  216. XEXTERN    int    Target;        /* TRUE if target found in makefile       */
  217. XEXTERN    int    If_expand;    /* TRUE if calling Expand from getinp.c   */
  218. XEXTERN  int    If_multi;    /* M_MULTI for expand of single MULTI macs*/
  219. XEXTERN    int    Readenv;    /* TRUE if defining macro from environment*/
  220. XEXTERN    int    Makemkf;    /* TRUE if making makefile(s)          */
  221. XEXTERN    int    Nest_level;    /* Nesting level for .IF .ELSE .END ...   */
  222. XEXTERN    int    Def_targets;    /* TRUE if defining targets          */
  223. X
  224. XEXTERN    LINKPTR Fringe_hd;    /* Pointer to head of the fringe list      */
  225. XEXTERN    LINKPTR Fringe_tl;    /* Pointer to tail of the fringe list      */
  226. X
  227. XEXTERN  HOWPTR  Current_target; /* HOW cell of current target being made  */
  228. XEXTERN  int    Wait_for_completion;
  229. XEXTERN  int    Doing_bang;
  230. X
  231. X/* Command line option flags are defined here.  They correspond one-for one
  232. X * with the flags defined in dmake.c */
  233. XEXTERN    int    Continue;    /* -k */
  234. XEXTERN    int    Get_env;    /* -e or -E */
  235. XEXTERN    int    Force;        /* -u */
  236. XEXTERN    int    Listing;    /* -p */
  237. XEXTERN    int    Rules;        /* -r */
  238. XEXTERN    int    Trace;        /* -n */
  239. XEXTERN    int    Touch;        /* -t */
  240. XEXTERN    int    Check;        /* -q */
  241. XEXTERN    int    Verbose;    /* -v */
  242. XEXTERN    int    Microsoft;    /* -M */
  243. XEXTERN    int    Transitive;    /* -T */
  244. X
  245. XEXTERN    HASHPTR    Macs[HASH_TABLE_SIZE];    /* hash table for macro defs    */
  246. XEXTERN    HASHPTR    Defs[HASH_TABLE_SIZE];    /* hash table for other defs    */
  247. X
  248. XEXTERN    char    *Buffer;        /* a general purpose buffer     */
  249. XEXTERN  int    Buffer_size;
  250. XEXTERN  int    Max_proclmt;        /* limit of max # of conc procs */
  251. XEXTERN    int    Max_proc;        /* max # of conc procs        */
  252. SHAR_EOF
  253. chmod 0440 vextern.h || echo "restore of vextern.h fails"
  254. echo "x - extracting version.h (Text)"
  255. sed 's/^X//' << 'SHAR_EOF' > version.h &&
  256. X/* dmake version number.  */
  257. X
  258. X#define VERSION "3.50"
  259. SHAR_EOF
  260. chmod 0440 version.h || echo "restore of version.h fails"
  261. echo mkdir - unix
  262. mkdir unix
  263. echo mkdir - unix/sysvr3
  264. mkdir unix/sysvr3
  265. echo "x - extracting unix/sysvr3/time.h (Text)"
  266. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/time.h &&
  267. X/*
  268. X** Berkeley get this wrong!
  269. X*/
  270. X#ifndef    TIME_h
  271. X#define    TIME_h
  272. X
  273. Xtypedef    long    time_t;    /* this is the thing we use */
  274. X
  275. X#endif    TIME_h
  276. X
  277. SHAR_EOF
  278. chmod 0640 unix/sysvr3/time.h || echo "restore of unix/sysvr3/time.h fails"
  279. echo "x - extracting unix/sysvr3/stdlib.h (Text)"
  280. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/stdlib.h &&
  281. X#ifndef _STDLIB_INCLUDED_
  282. X#define _STDLIB_INCLUDED_
  283. X
  284. Xextern /*GOTO*/ _exit();
  285. Xextern /*GOTO*/ exit();
  286. Xextern /*GOTO*/ abort();
  287. Xextern int system();
  288. Xextern char *getenv();
  289. Xextern char *calloc();
  290. Xextern char *malloc();
  291. Xextern char *realloc();
  292. Xextern free();
  293. Xextern int errno;
  294. X
  295. X#ifndef EIO
  296. X#    include <errno.h>
  297. X#endif
  298. X
  299. X#endif /* _STDLIB_INCLUDED_ */
  300. SHAR_EOF
  301. chmod 0640 unix/sysvr3/stdlib.h || echo "restore of unix/sysvr3/stdlib.h fails"
  302. echo "x - extracting unix/sysvr3/stdarg.h (Text)"
  303. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/stdarg.h &&
  304. X/*
  305. X * stdarg.h
  306. X *
  307. X * defines ANSI style macros for accessing arguments of a function which takes
  308. X * a variable number of arguments
  309. X *
  310. X */
  311. X
  312. X#if !defined(__STDARG)
  313. X#define __STDARG
  314. X
  315. Xtypedef char *va_list;
  316. X
  317. X#define va_dcl int va_alist
  318. X#define va_start(ap,v)  ap = (va_list)&va_alist
  319. X#define va_arg(ap,t)    ((t*)(ap += sizeof(t)))[-1]
  320. X#define va_end(ap)      ap = NULL
  321. X#endif
  322. SHAR_EOF
  323. chmod 0640 unix/sysvr3/stdarg.h || echo "restore of unix/sysvr3/stdarg.h fails"
  324. echo "x - extracting unix/sysvr3/startup.mk (Text)"
  325. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/startup.mk &&
  326. X# Generic UNIX DMAKE startup file.  Customize to suit your needs.
  327. X# Should work for both SYSV, and BSD 4.3
  328. X# See the documentation for a description of internally defined macros.
  329. X#
  330. X# Disable warnings for macros redefined here that were given
  331. X# on the command line.
  332. X__.SILENT := $(.SILENT)
  333. X.SILENT   := yes
  334. X
  335. X# Configuration parameters for DMAKE startup.mk file
  336. X# Set these to NON-NULL if you wish to turn the parameter on.
  337. X_HAVE_RCS    := yes        # yes => RCS  is installed.
  338. X_HAVE_SCCS    := yes        # yes => SCCS is installed.
  339. X
  340. X# Applicable suffix definitions
  341. XA := .a        # Libraries
  342. XE :=        # Executables
  343. XF := .f        # Fortran
  344. XO := .o        # Objects
  345. XP := .p        # Pascal
  346. XS := .s        # Assembler sources
  347. XV := ,v        # RCS suffix
  348. X
  349. X# Recipe execution configurations
  350. XSHELL        := /bin/sh
  351. XSHELLFLAGS    := -ce
  352. XGROUPSHELL    := $(SHELL)
  353. XGROUPFLAGS    := 
  354. XSHELLMETAS    := |();&<>?*][$$:\\#`'"
  355. XGROUPSUFFIX    :=
  356. X
  357. X# Standard C-language command names and flags
  358. X   CPP       := /lib/cpp        # C-preprocessor
  359. X   CC      := cc        # C-compiler and flags
  360. X   CFLAGS   =
  361. X
  362. X   AS      := as        # Assembler and flags
  363. X   ASFLAGS  = 
  364. X
  365. X   LD       = $(CC)        # Loader and flags
  366. X   LDFLAGS  =
  367. X   LDLIBS   =
  368. X
  369. X# Definition of $(MAKE) macro for recursive makes.
  370. X   MAKE = $(MAKECMD) $(MFLAGS)
  371. X
  372. X# Definition of Print command for this system.
  373. X   PRINT = lpr
  374. X
  375. X# Language and Parser generation Tools and their flags
  376. X   YACC      := yacc        # standard yacc
  377. X   YFLAGS  =
  378. X   YTAB      := y.tab        # yacc output files name stem.
  379. X
  380. X   LEX      := lex        # standard lex
  381. X   LFLAGS  =
  382. X   LEXYY  := lex.yy        # lex output file
  383. X
  384. X# Other Compilers, Tools and their flags
  385. X   PC    := pc            # pascal compiler
  386. X   RC    := f77            # ratfor compiler
  387. X   FC    := f77            # fortran compiler
  388. X
  389. X   CO       := co        # check out for RCS
  390. X   COFLAGS := -q
  391. X
  392. X   AR     := ar            # archiver
  393. X   ARFLAGS = ruv
  394. X
  395. X   RM       := /bin/rm        # remove a file command
  396. X   RMFLAGS  =
  397. X
  398. X# Implicit generation rules for making inferences.
  399. X# We don't provide .yr or .ye rules here.  They're obsolete.
  400. X# Rules for making *$O
  401. X   %$O : %.c ; $(CC) $(CFLAGS) -c $<
  402. X   %$O : %$P ; $(PC) $(PFLAGS) -c $<
  403. X   %$O : %$S ; $(AS) $<
  404. X   %$O : %.cl ; class -c $<
  405. X   %$O : %.e %.r %.F %$F
  406. X    $(FC) $(RFLAGS) $(EFLAGS) $(FFLAGS) -c $<
  407. X
  408. X# Executables
  409. X   %$E : %$O ; $(LD) $(LDFLAGS) -o $@ $< $(LDLIBES)
  410. X
  411. X# lex and yacc rules
  412. X   %.c : %.y ; $(YACC)  $(YFLAGS) $<; mv $(YTAB).c $@
  413. X   %.c : %.l ; $(LEX)   $(LFLAGS) $<; mv $(LEXYY).c $@
  414. X
  415. X# This rule tells how to make *.out from it's immediate list of prerequisites
  416. X# UNIX only.
  417. X   %.out :; $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
  418. X
  419. X# RCS support
  420. X.IF $(_HAVE_RCS)
  421. X   % : %$V $$(@:d)RCS/$$(@:f)$V;- $(CO) $(COFLAGS) $@
  422. X   .NOINFER : %$V $$(@:d)RCS/$$(@:f)$V
  423. X.END
  424. X
  425. X# SCCS support
  426. X.IF $(_HAVE_SCCS)
  427. X   % : s.% ; get $@
  428. X   .NOINFER : s.%
  429. X.END
  430. X
  431. X# Recipe to make archive files.
  432. X%$A :
  433. X[
  434. X   $(AR) $(ARFLAGS) $@ $?
  435. X   $(RM) $(RMFLAGS) $?
  436. X   ranlib $@
  437. X]
  438. X
  439. X# DMAKE uses this recipe to remove intermediate targets
  440. X.REMOVE :; $(RM) -f $<
  441. X
  442. X# AUGMAKE extensions for SYSV compatibility
  443. X@B = $(@:b)
  444. X@D = $(@:d)
  445. X@F = $(@:f)
  446. X*B = $(*:b)
  447. X*D = $(*:d)
  448. X*F = $(*:f)
  449. X<B = $(<:b)
  450. X<D = $(<:d)
  451. X<F = $(<:f)
  452. X?B = $(?:b)
  453. X?F = $(?:f)
  454. X?D = $(?:d)
  455. X
  456. X# Turn warnings back to previous setting.
  457. X.SILENT := $(__.SILENT)
  458. X
  459. X# Local startup file if any
  460. X.INCLUDE .IGNORE: "_startup.mk"
  461. SHAR_EOF
  462. chmod 0640 unix/sysvr3/startup.mk || echo "restore of unix/sysvr3/startup.mk fails"
  463. echo "x - extracting unix/sysvr3/make.sh (Text)"
  464. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/make.sh &&
  465. Xmkdir objects
  466. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O infer.c
  467. Xmv infer.o objects
  468. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O make.c
  469. Xmv make.o objects
  470. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O stat.c
  471. Xmv stat.o objects
  472. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O expand.c
  473. Xmv expand.o objects
  474. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O string.c
  475. Xmv string.o objects
  476. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O hash.c
  477. Xmv hash.o objects
  478. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dag.c
  479. Xmv dag.o objects
  480. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dmake.c
  481. Xmv dmake.o objects
  482. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O path.c
  483. Xmv path.o objects
  484. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O imacs.c
  485. Xmv imacs.o objects
  486. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O sysintf.c
  487. Xmv sysintf.o objects
  488. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O parse.c
  489. Xmv parse.o objects
  490. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O getinp.c
  491. Xmv getinp.o objects
  492. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O quit.c
  493. Xmv quit.o objects
  494. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O basename.c
  495. Xmv basename.o objects
  496. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O dump.c
  497. Xmv dump.o objects
  498. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O macparse.c
  499. Xmv macparse.o objects
  500. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O rulparse.c
  501. Xmv rulparse.o objects
  502. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O percent.c
  503. Xmv percent.o objects
  504. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/arlib.c
  505. Xmv arlib.o objects
  506. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/dirbrk.c
  507. Xmv dirbrk.o objects
  508. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/explode.c
  509. Xmv explode.o objects
  510. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/rmprq.c
  511. Xmv rmprq.o objects
  512. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/ruletab.c
  513. Xmv ruletab.o objects
  514. Xcc -c -DHELP -I. -Icommon -Iunix -Iunix/sysvr3 -O unix/runargv.c
  515. Xmv runargv.o objects
  516. Xcc  -o dmake  objects/infer.o objects/make.o objects/stat.o objects/expand.o objects/string.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/basename.o objects/dump.o objects/macparse.o objects/rulparse.o objects/percent.o objects/arlib.o objects/dirbrk.o objects/explode.o objects/rmprq.o objects/ruletab.o objects/runargv.o 
  517. SHAR_EOF
  518. chmod 0640 unix/sysvr3/make.sh || echo "restore of unix/sysvr3/make.sh fails"
  519. echo "x - extracting unix/sysvr3/config.mk (Text)"
  520. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/config.mk &&
  521. X# This is the SysV R3 UNIX configuration file for DMAKE
  522. X#    It simply modifies the values of SRC, and checks to see if
  523. X#    OSENVIRONMENT is defined.  If so it includes the appropriate
  524. X#    config.mk file.
  525. X#
  526. X# It also sets the values of .SOURCE.c and .SOURCE.h to include the local
  527. X# directory.
  528. X#
  529. Xosrdir := $(OS)$(DIRSEPSTR)$(OSRELEASE)
  530. X
  531. X# The following sources are required for SysV R3
  532. XSRC +=  #zero for now. we do have some .h's though
  533. X
  534. X#.SOURCE.c : $(osrdir)
  535. X.SOURCE.h : $(osrdir)
  536. X
  537. X# Local configuration modifications for CFLAGS, there's local SysV includes
  538. X# too.
  539. XCFLAGS += -I$(osrdir)
  540. X
  541. X# See if we modify anything in the lower levels.
  542. X.IF $(OSENVIRONMENT) != $(NULL)
  543. X   .INCLUDE .IGNORE : $(osrdir)$(DIRSEPSTR)$(OSENVIRONMENT)$(DIRSEPSTR)config.mk
  544. X.END
  545. SHAR_EOF
  546. chmod 0640 unix/sysvr3/config.mk || echo "restore of unix/sysvr3/config.mk fails"
  547. echo "x - extracting unix/sysvr3/config.h (Text)"
  548. sed 's/^X//' << 'SHAR_EOF' > unix/sysvr3/config.h &&
  549. X/* RCS      -- $Header$
  550. X-- SYNOPSIS -- Configurarion include file.
  551. X-- 
  552. X-- DESCRIPTION
  553. X--     There is one of these for each specific machine configuration.
  554. X--    It can be used to further tweek the machine specific sources
  555. X--    so that they compile.
  556. X--
  557. X-- AUTHOR
  558. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  559. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  560. X--
  561. X-- COPYRIGHT
  562. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  563. X-- 
  564. X--      This program is free software; you can redistribute it and/or
  565. X--      modify it under the terms of the GNU General Public License
  566. X--      (version 1), as published by the Free Software Foundation, and
  567. X--      found in the file 'LICENSE' included with this distribution.
  568. X-- 
  569. X--      This program is distributed in the hope that it will be useful,
  570. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  571. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  572. X--      GNU General Public License for more details.
  573. X-- 
  574. X--      You should have received a copy of the GNU General Public License
  575. X--      along with this program;  if not, write to the Free Software
  576. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  577. X--
  578. X-- LOG
  579. X--     $Log$
  580. X*/
  581. X
  582. X/* define this for configurations that don't have the coreleft function
  583. X * so that the code compiles.  To my knowledge coreleft exists only on
  584. X * Turbo C, but it is needed here since the function is used in many debug
  585. X * macros. */
  586. X#define coreleft() 0L
  587. X
  588. X/* Define the getcwd function that is used in the code, since BSD does
  589. X * not have getcwd, but call it getwd instead. */
  590. Xextern char *getcwd ANSI((char *, int));
  591. X
  592. X/* Define setvbuf, SysV doesn't have one */
  593. X#define setvbuf(fp, bp, type, len) setbuf( fp, NULL );
  594. X
  595. X/* NCR Tower's don't define size_t */
  596. X#ifdef tower
  597. Xtypedef long size_t;
  598. X#endif
  599. SHAR_EOF
  600. chmod 0640 unix/sysvr3/config.h || echo "restore of unix/sysvr3/config.h fails"
  601. echo "x - extracting unix/sysintf.h (Text)"
  602. sed 's/^X//' << 'SHAR_EOF' > unix/sysintf.h &&
  603. X/*
  604. X** assorted bits of system interface, for common routines inside dmake.
  605. X** System specific code can be found in the config.h files for each
  606. X** of the system specifications.
  607. X*/
  608. X#include <sys/stat.h>
  609. X#include <signal.h>
  610. X
  611. X#define STAT stat
  612. X#define VOID_LCACHE(l,m) (void) void_lcache(l,m)
  613. X
  614. X/*
  615. X** standard C items
  616. X*/
  617. X#include "macros.h"
  618. X
  619. X/*
  620. X** DOS interface standard items
  621. X*/
  622. X#define    getswitchar()    '-'
  623. X
  624. X/*
  625. X** make parameters
  626. X*/
  627. X#define    MAXARGV    600
  628. X#define    MAX_PATH_LEN    1024
  629. SHAR_EOF
  630. chmod 0440 unix/sysintf.h || echo "restore of unix/sysintf.h fails"
  631. echo "x - extracting unix/startup.h (Text)"
  632. sed 's/^X//' << 'SHAR_EOF' > unix/startup.h &&
  633. X/* This file contains the default value of the MAKESTARTUP variable.
  634. X * You must set the quoted string below to the default path to the startup
  635. X * variable, so that it gets compiled in.  LEAVE ROOTDIR at the front of
  636. X * the path.  This allows the user to customize his environment for dmake
  637. X * by setting up a new ROOTDIR environment variable. */
  638. X
  639. X"MAKESTARTUP := $(ROOTDIR)/usr/software/dmake/data/startup.mk",
  640. SHAR_EOF
  641. chmod 0440 unix/startup.h || echo "restore of unix/startup.h fails"
  642. echo "x - extracting unix/runargv.c (Text)"
  643. sed 's/^X//' << 'SHAR_EOF' > unix/runargv.c &&
  644. X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/runargv.c,v 1.1 90/07/20 16:54:53 dvadura Exp $
  645. X-- SYNOPSIS -- invoke a sub process.
  646. X-- 
  647. X-- DESCRIPTION
  648. X--     Use the standard methods of executing a sub process.
  649. X--
  650. X-- AUTHOR
  651. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  652. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  653. X--
  654. X-- COPYRIGHT
  655. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  656. X-- 
  657. X--      This program is free software; you can redistribute it and/or
  658. X--      modify it under the terms of the GNU General Public License
  659. X--      (version 1), as published by the Free Software Foundation, and
  660. X--      found in the file 'LICENSE' included with this distribution.
  661. X-- 
  662. X--      This program is distributed in the hope that it will be useful,
  663. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  664. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  665. X--      GNU General Public License for more details.
  666. X-- 
  667. X--      You should have received a copy of the GNU General Public License
  668. X--      along with this program;  if not, write to the Free Software
  669. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  670. X--
  671. X-- LOG
  672. X--     $Log:    runargv.c,v $
  673. X * Revision 1.1  90/07/20  16:54:53  dvadura
  674. X * Initial Revision of Version 3.5
  675. X * 
  676. X*/
  677. X
  678. X#include <signal.h>
  679. X#include "extern.h"
  680. X#include "sysintf.h"
  681. X#include "alloc.h"
  682. X
  683. Xtypedef struct prp {
  684. X   char *prp_cmd;
  685. X   int   prp_group;
  686. X   int   prp_ignore;
  687. X   int   prp_last;
  688. X   struct prp *prp_next;
  689. X   char  *prp_dir;
  690. X} RCP, *RCPPTR;
  691. X
  692. Xtypedef struct pr {
  693. X   int        pr_valid;
  694. X   int        pr_pid;
  695. X   CELLPTR    pr_target;
  696. X   HOWPTR    pr_how;
  697. X   int        pr_ignore;
  698. X   int        pr_last;
  699. X   RCPPTR      pr_recipe;
  700. X   RCPPTR      pr_recipe_end;
  701. X} PR;
  702. X
  703. Xstatic PR  *_procs    = NIL(PR);
  704. Xstatic int  _proc_cnt = 0;
  705. Xstatic int  _abort_flg= FALSE;
  706. Xstatic int  _use_i    = -1;
  707. Xstatic int  _do_upd   = 0;
  708. X
  709. Xstatic  void    _add_child ANSI((int, CELLPTR, HOWPTR, int, int));
  710. Xstatic  void    _attach_cmd ANSI((char *, int, int, CELLPTR, HOWPTR, int));
  711. Xstatic  void    _finished_child ANSI((int, int));
  712. Xstatic  int     _running ANSI((CELLPTR, HOWPTR));
  713. X
  714. Xint
  715. Xrunargv(target, how, ignore, group, last, cmd)
  716. XCELLPTR target;
  717. XHOWPTR  how;
  718. Xint     ignore;
  719. Xint    group;
  720. Xint    last;
  721. Xchar    *cmd;
  722. X{
  723. X   extern  int  errno;
  724. X   extern  char *sys_errlist[];
  725. X   int          pid;
  726. X   char         *argv[MAXARGV];
  727. X
  728. X   if( _running(target, how) /*&& Max_proc != 1*/ ) {
  729. X      /* The command will be executed when the previous recipe
  730. X       * line completes. */
  731. X      _attach_cmd( cmd, group, ignore, target, how, last );
  732. X      return(1);
  733. X   }
  734. X
  735. X   Pack_argv( argv, MAXARGV, group, cmd );
  736. X
  737. X   while( _proc_cnt == Max_proc )
  738. X      if( Wait_for_child(FALSE, -1) == -1 )  Fatal( "Lost a child" );
  739. X
  740. X   switch( pid=fork() ){
  741. X      int   wid;
  742. X      int   status;
  743. X
  744. X   case -1: /* fork failed */
  745. X      Error("%s: %s", argv[0], sys_errlist[errno]);
  746. X      Handle_result(-1, ignore, _abort_flg, target);
  747. X      return(-1);
  748. X
  749. X   case 0:  /* child */
  750. X      execvp(argv[0], argv);
  751. X      Continue = TRUE;   /* survive error message */
  752. X      Error("%s: %s", argv[0], sys_errlist[errno]);
  753. X      kill(getpid(), SIGTERM);
  754. X      /*NOTREACHED*/
  755. X
  756. X   default: /* parent */
  757. X      _add_child(pid, target, how, ignore, last);
  758. X   }
  759. X
  760. X   return(1);
  761. X}
  762. X
  763. X
  764. Xint
  765. XWait_for_child( abort_flg, pid )
  766. Xint abort_flg;
  767. Xint pid;
  768. X{
  769. X   int wid;
  770. X   int status;
  771. X   int waitchild;
  772. X
  773. X   waitchild = (pid == -1)? FALSE : Wait_for_completion;
  774. X
  775. X   do {
  776. X      if( (wid = wait(&status)) == -1 ) return(-1);
  777. X
  778. X      _abort_flg = abort_flg;
  779. X      _finished_child(wid, status);
  780. X      _abort_flg = FALSE;
  781. X   }
  782. X   while( waitchild && pid != wid );
  783. X
  784. X   return(0);
  785. X}
  786. X
  787. X
  788. Xvoid
  789. XClean_up_processes()
  790. X{
  791. X   register int i;
  792. X
  793. X   if( _procs != NIL(PR) ) {
  794. X      for( i=0; i<Max_proc; i++ )
  795. X     if( _procs[i].pr_valid )
  796. X        kill(_procs[i].pr_pid, SIGTERM);
  797. X
  798. X      while( Wait_for_child(TRUE, -1) != -1 );
  799. X   }
  800. X}
  801. X
  802. X
  803. Xstatic void
  804. X_add_child( pid, target, how, ignore, last )
  805. Xint    pid;
  806. XCELLPTR target;
  807. XHOWPTR  how;
  808. Xint    ignore;
  809. Xint     last;
  810. X{
  811. X   register int i;
  812. X   register PR *pp;
  813. X
  814. X   if( _procs == NIL(PR) ) {
  815. X      TALLOC( _procs, Max_proc, PR );
  816. X   }
  817. X
  818. X   if( (i = _use_i) == -1 )
  819. X      for( i=0; i<Max_proc; i++ )
  820. X     if( !_procs[i].pr_valid )
  821. X        break;
  822. X
  823. X   pp = _procs+i;
  824. X
  825. X   pp->pr_valid  = 1;
  826. X   pp->pr_pid    = pid;
  827. X   pp->pr_target = target;
  828. X   pp->pr_how    = how;
  829. X   pp->pr_ignore = ignore;
  830. X   pp->pr_last   = last;
  831. X
  832. X   Current_target = NIL(HOW);
  833. X
  834. X   _proc_cnt++;
  835. X
  836. X   if( Wait_for_completion ) Wait_for_child( FALSE, pid );
  837. X}
  838. X
  839. X
  840. Xstatic void
  841. X_finished_child(pid, status)
  842. Xint    pid;
  843. Xint    status;
  844. X{
  845. X   register int i;
  846. X   register PR *pp;
  847. X
  848. X   for( i=0; i<Max_proc; i++ )
  849. X      if( _procs[i].pr_valid && _procs[i].pr_pid == pid )
  850. X     break;
  851. X
  852. X   _procs[i].pr_valid = 0;
  853. X   _proc_cnt--;
  854. X
  855. X   if( _procs[i].pr_recipe != NIL(RCP) && !_abort_flg ) {
  856. X      RCPPTR rp = _procs[i].pr_recipe;
  857. X      char   *dir;
  858. X
  859. X      Current_target = _procs[i].pr_how;
  860. X      Handle_result( status, _procs[i].pr_ignore, FALSE, _procs[i].pr_target );
  861. X      Current_target = NIL(HOW);
  862. X
  863. X      _procs[i].pr_recipe = rp->prp_next;
  864. X
  865. X      _use_i = i;
  866. X      dir = _strdup(Get_current_dir());
  867. X      Set_dir( rp->prp_dir );
  868. X      runargv( _procs[i].pr_target, _procs[i].pr_how, rp->prp_ignore,
  869. X                 rp->prp_group, rp->prp_last, rp->prp_cmd );
  870. X      Set_dir(dir);
  871. X      FREE(dir);
  872. X      FREE(rp->prp_dir);
  873. X      _use_i = -1;
  874. X
  875. X      FREE( rp->prp_cmd );
  876. X      FREE( rp );
  877. X
  878. X      if( _proc_cnt == Max_proc ) Wait_for_child( FALSE, -1 );
  879. X   }
  880. X   else {
  881. X      Unlink_temp_files( _procs[i].pr_how );
  882. X      Handle_result(status,_procs[i].pr_ignore,_abort_flg,_procs[i].pr_target);
  883. X
  884. X      if( _procs[i].pr_last && !Doing_bang )
  885. X     Update_time_stamp( _procs[i].pr_target, _procs[i].pr_how );
  886. X   }
  887. X}
  888. X
  889. X
  890. Xstatic int
  891. X_running( cp, how )
  892. XCELLPTR cp;
  893. XHOWPTR  how;
  894. X{
  895. X   register int i;
  896. X
  897. X   if( !_procs ) return(FALSE);
  898. X
  899. X   for( i=0; i<Max_proc; i++ )
  900. X      if( _procs[i].pr_valid &&
  901. X      _procs[i].pr_how == how &&
  902. X      _procs[i].pr_target == cp  )
  903. X     break;
  904. X     
  905. X   return( i != Max_proc );
  906. X}
  907. X
  908. X
  909. Xstatic void
  910. X_attach_cmd( cmd, group, ignore, cp, how, last )
  911. Xchar    *cmd;
  912. Xint    group;
  913. Xint     ignore;
  914. XCELLPTR cp;
  915. XHOWPTR  how;
  916. Xint     last;
  917. X{
  918. X   register int i;
  919. X   RCPPTR rp;
  920. X
  921. X   for( i=0; i<Max_proc; i++ )
  922. X      if( _procs[i].pr_valid &&
  923. X      _procs[i].pr_how == how &&
  924. X      _procs[i].pr_target == cp  )
  925. X     break;
  926. X
  927. X   TALLOC( rp, 1, RCP );
  928. X   rp->prp_cmd   = _strdup(cmd);
  929. X   rp->prp_group = group;
  930. X   rp->prp_ignore= ignore;
  931. X   rp->prp_last  = last;
  932. X   rp->prp_dir   = _strdup(Get_current_dir());
  933. X
  934. X   if( _procs[i].pr_recipe == NIL(RCP) )
  935. X      _procs[i].pr_recipe = _procs[i].pr_recipe_end = rp;
  936. X   else {
  937. X      _procs[i].pr_recipe_end->prp_next = rp;
  938. X      _procs[i].pr_recipe_end = rp;
  939. X   }
  940. X}
  941. SHAR_EOF
  942. chmod 0440 unix/runargv.c || echo "restore of unix/runargv.c fails"
  943. echo "x - extracting unix/ruletab.c (Text)"
  944. sed 's/^X//' << 'SHAR_EOF' > unix/ruletab.c &&
  945. X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/ruletab.c,v 1.1 90/07/19 14:04:42 dvadura Exp $
  946. X-- SYNOPSIS -- Default initial configuration of dmake.
  947. X-- 
  948. X-- DESCRIPTION
  949. X--     Define here the initial set of rules that are defined before
  950. X--    dmake performs any processing.
  951. X--
  952. X-- AUTHOR
  953. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  954. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  955. X--
  956. X-- COPYRIGHT
  957. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  958. X-- 
  959. X--      This program is free software; you can redistribute it and/or
  960. X--      modify it under the terms of the GNU General Public License
  961. X--      (version 1), as published by the Free Software Foundation, and
  962. X--      found in the file 'LICENSE' included with this distribution.
  963. X-- 
  964. X--      This program is distributed in the hope that it will be useful,
  965. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  966. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  967. X--      GNU General Public License for more details.
  968. X-- 
  969. X--      You should have received a copy of the GNU General Public License
  970. X--      along with this program;  if not, write to the Free Software
  971. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  972. X--
  973. X-- LOG
  974. X--     $Log:    ruletab.c,v $
  975. X * Revision 1.1  90/07/19  14:04:42  dvadura
  976. X * Initial Revision of Version 3.5
  977. X * 
  978. X*/
  979. X
  980. X/* These are control macros for dmake that MUST be defined at some point
  981. X * if they are NOT dmake will not work!  These are default definitions.  They
  982. X * may be overridden inside the .STARTUP makefile, they are here
  983. X * strictly so that dmake can parse the STARTUP makefile */
  984. X
  985. Xstatic char *_rules[] = {
  986. X    "MAXPROCESSLIMIT := 10",
  987. X    "MAXLINELENGTH := 8190",
  988. X    ".IMPORT .IGNORE: ROOTDIR",
  989. X    ".MAKEFILES : makefile.mk Makefile makefile",
  990. X    ".SOURCE    : .NULL",
  991. X#include "startup.h"
  992. X    0 };
  993. X
  994. Xchar **Rule_tab = _rules; /* for sundry reasons in Get_environment() */
  995. SHAR_EOF
  996. chmod 0440 unix/ruletab.c || echo "restore of unix/ruletab.c fails"
  997. echo "x - extracting unix/rmprq.c (Text)"
  998. sed 's/^X//' << 'SHAR_EOF' > unix/rmprq.c &&
  999. X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/rmprq.c,v 1.1 90/07/20 16:58:12 dvadura Exp $
  1000. X-- SYNOPSIS -- remove prerequisites code.
  1001. X-- 
  1002. X-- DESCRIPTION
  1003. X--    This code is different for DOS and for UNIX and parallel make
  1004. X--    architectures since the parallel case requires the rm's to be
  1005. X--    run in parallel, whereas DOS guarantees to run them sequentially.
  1006. X-- 
  1007. X-- AUTHOR
  1008. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1009. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1010. X--
  1011. X-- COPYRIGHT
  1012. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1013. X-- 
  1014. X--      This program is free software; you can redistribute it and/or
  1015. X--      modify it under the terms of the GNU General Public License
  1016. X--      (version 1), as published by the Free Software Foundation, and
  1017. X--      found in the file 'LICENSE' included with this distribution.
  1018. X-- 
  1019. X--      This program is distributed in the hope that it will be useful,
  1020. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1021. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1022. X--      GNU General Public License for more details.
  1023. X-- 
  1024. X--      You should have received a copy of the GNU General Public License
  1025. X--      along with this program;  if not, write to the Free Software
  1026. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1027. X--
  1028. X-- LOG
  1029. X--     $Log:    rmprq.c,v $
  1030. X * Revision 1.1  90/07/20  16:58:12  dvadura
  1031. X * Initial Revision of Version 3.5
  1032. X * 
  1033. X*/
  1034. X
  1035. X#include "extern.h"
  1036. X#include "alloc.h"
  1037. X
  1038. Xvoid
  1039. XRemove_prq( tcp )
  1040. XCELLPTR tcp;
  1041. X{
  1042. X   static  LINKPTR rlp = NIL(LINK);
  1043. X   static  flag = 0;
  1044. X   static  HASHPTR m_at, m_q, m_b, m_g, m_l, m_bb, m_up;
  1045. X   char    *m_at_s, *m_g_s, *m_q_s, *m_b_s, *m_l_s, *m_bb_s, *m_up_s;
  1046. X   LINKPTR tlp;
  1047. X
  1048. X   tcp->ce_flag         &= ~(F_MADE|F_VISITED);
  1049. X   tcp->CE_HOW->hw_flag &= ~(F_MADE|F_VISITED);
  1050. X   tcp->ce_time          = 0L;
  1051. X
  1052. X   for( tlp=rlp; tlp !=NIL(LINK); tlp=tlp->cl_next )
  1053. X      if( (tlp->cl_prq->ce_flag & (F_VISITED|F_MADE)) != F_VISITED )
  1054. X     break;
  1055. X
  1056. X   if( tlp == NIL(LINK) ) {
  1057. X      TALLOC(tlp, 1, LINK);
  1058. X      TALLOC(tlp->cl_prq, 1, CELL);
  1059. X      tlp->cl_next = rlp;
  1060. X      rlp = tlp;
  1061. X   }
  1062. X
  1063. X   *tlp->cl_prq = *tcp;
  1064. X
  1065. X   /* We save the dynamic macro values here, as it is possible that the
  1066. X    * .REMOVE recipe is getting executed for a target while some other target
  1067. X    * is in the middle of executing it's list of recipe lines, in this case
  1068. X    * the values of $@ etc, must be preserved so that when we return to
  1069. X    * complete the other recipe we must make certain that the values of it's
  1070. X    * dynamic macros are unmodified. */
  1071. X
  1072. X   if( !flag ) {
  1073. X      /* Do the getting of the macros only once. */
  1074. X      flag = 1;
  1075. X      m_at = Get_name("@", Macs, TRUE, NIL(CELL));
  1076. X      m_g  = Get_name(">", Macs, TRUE, NIL(CELL));
  1077. X      m_q  = Get_name("?", Macs, TRUE, NIL(CELL));
  1078. X      m_b  = Get_name("<", Macs, TRUE, NIL(CELL));
  1079. X      m_l  = Get_name("&", Macs, TRUE, NIL(CELL));
  1080. X      m_bb = Get_name("*", Macs, TRUE, NIL(CELL));
  1081. X      m_up = Get_name("^", Macs, TRUE, NIL(CELL));
  1082. X   }
  1083. X
  1084. X   m_at_s = m_at->ht_value; m_at->ht_value = NIL(char);
  1085. X   m_g_s  = m_g->ht_value;  m_g->ht_value  = NIL(char);
  1086. X   m_q_s  = m_q->ht_value;  m_q->ht_value  = NIL(char);
  1087. X   m_b_s  = m_b->ht_value;  m_b->ht_value  = NIL(char);
  1088. X   m_l_s  = m_l->ht_value;  m_l->ht_value  = NIL(char);
  1089. X   m_bb_s = m_bb->ht_value; m_bb->ht_value = NIL(char);
  1090. X   m_up_s = m_up->ht_value; m_up->ht_value = NIL(char);
  1091. X
  1092. X   Make( tlp->cl_prq, tlp->cl_prq->CE_HOW, NIL(CELL) );
  1093. X
  1094. X   m_at->ht_value = m_at_s;
  1095. X   m_g->ht_value  = m_g_s;
  1096. X   m_q->ht_value  = m_q_s;
  1097. X   m_b->ht_value  = m_b_s;
  1098. X   m_l->ht_value  = m_l_s;
  1099. X   m_bb->ht_value = m_bb_s;
  1100. X   m_up->ht_value = m_up_s;
  1101. X}
  1102. SHAR_EOF
  1103. chmod 0440 unix/rmprq.c || echo "restore of unix/rmprq.c fails"
  1104. echo "x - extracting unix/explode.c (Text)"
  1105. sed 's/^X//' << 'SHAR_EOF' > unix/explode.c &&
  1106. X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/explode.c,v 1.1 90/07/19 14:04:39 dvadura Exp $
  1107. X-- SYNOPSIS -- Routines to explode dag if .SETDIR targets present.
  1108. X-- 
  1109. X-- DESCRIPTION
  1110. X--    These routines are called by parallel dmake implementations to
  1111. X--    explode the dmake DAG at .SETDIR targets so that parallel makes
  1112. X--    can traverse common portions of the DAG in parallel.
  1113. X-- 
  1114. X-- AUTHOR
  1115. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1116. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1117. X--
  1118. X-- COPYRIGHT
  1119. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1120. X-- 
  1121. X--      This program is free software; you can redistribute it and/or
  1122. X--      modify it under the terms of the GNU General Public License
  1123. X--      (version 1), as published by the Free Software Foundation, and
  1124. X--      found in the file 'LICENSE' included with this distribution.
  1125. X-- 
  1126. X--      This program is distributed in the hope that it will be useful,
  1127. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1128. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1129. X--      GNU General Public License for more details.
  1130. X-- 
  1131. X--      You should have received a copy of the GNU General Public License
  1132. X--      along with this program;  if not, write to the Free Software
  1133. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1134. X--
  1135. X-- LOG
  1136. X--     $Log:    explode.c,v $
  1137. X * Revision 1.1  90/07/19  14:04:39  dvadura
  1138. X * Initial Revision of Version 3.5
  1139. X * 
  1140. X*/
  1141. X
  1142. X#include "extern.h"
  1143. X#include "alloc.h"
  1144. X#include "db.h"
  1145. X
  1146. XCELLPTR
  1147. XExplode_cell( cp, dir )
  1148. XCELLPTR cp;
  1149. XCELLPTR dir;
  1150. X{
  1151. X   int explode = FALSE;
  1152. X   CELLPTR root;
  1153. X   CELLPTR tcp;
  1154. X   CELLPTR ocp;
  1155. X   HOWPTR  fhow = NIL(HOW);
  1156. X
  1157. X
  1158. X   if( cp == NIL(CELL) ) return(cp);
  1159. X
  1160. X   ocp = cp;
  1161. X   if( (root = cp->ce_name->CP_ROOT) != dir ) {
  1162. X      if( cp->ce_name->CP_ROOT != NIL(CELL) ) {
  1163. X     HASHPTR name;
  1164. X
  1165. X     tcp  = Def_cell(cp->CE_NAME, dir);
  1166. X     name = tcp->ce_name;
  1167. X     *tcp = *cp;
  1168. X     tcp->ce_name = name;
  1169. X
  1170. X     cp = tcp;
  1171. X     explode = TRUE;
  1172. X      }
  1173. X   }
  1174. X   else if( root && root == dir )
  1175. X      return( cp );
  1176. X
  1177. X   /* The code here is required, as it takes care of the .UPDATEALL common
  1178. X    * targets. */
  1179. X   tcp = cp;
  1180. X   do {
  1181. X      tcp->ce_name->CP_ROOT = dir;
  1182. X
  1183. X      if( tcp->CE_HOW != fhow ) {
  1184. X     tcp->CE_HOW = Explode_how( tcp->CE_HOW, cp->ce_dir?cp:dir, explode );
  1185. X     if( tcp == cp ) fhow = tcp->CE_HOW;
  1186. X      }
  1187. X
  1188. X      if( explode && tcp->ce_all )
  1189. X         if( tcp->ce_all != ocp ) {
  1190. X        CELLPTR ttcp = Def_cell( tcp->ce_all->CE_NAME, dir );
  1191. X        HASHPTR name = ttcp->ce_name;
  1192. X
  1193. X        *ttcp = *tcp->ce_all;
  1194. X        ttcp->ce_name = name;
  1195. X        tcp->ce_all   = ttcp;
  1196. X        ttcp->CE_HOW  = fhow;
  1197. X     }
  1198. X     else
  1199. X        tcp->ce_all = cp;
  1200. X
  1201. X      tcp = tcp->ce_all;
  1202. X   }
  1203. X   while( tcp != NIL(CELL) && tcp != cp );
  1204. X
  1205. X   return( cp );
  1206. X}
  1207. X
  1208. X
  1209. XHOWPTR
  1210. XExplode_how( how, dir, copy )
  1211. XHOWPTR  how;
  1212. XCELLPTR dir;
  1213. Xint     copy;
  1214. X{
  1215. X   if( how == NIL(HOW) ) return( how );
  1216. X
  1217. X   if( copy ) {
  1218. X      HOWPTR thow;
  1219. X
  1220. X      TALLOC( thow, 1, HOW );
  1221. X      *thow = *how;
  1222. X      how = thow;
  1223. X   }
  1224. X
  1225. X   how->hw_next = Explode_how( how->hw_next, dir, copy );
  1226. X   how->hw_prq  = Explode_prq( how->hw_prq, dir, copy );
  1227. X
  1228. X   return( how );
  1229. X}
  1230. X
  1231. X
  1232. XLINKPTR
  1233. XExplode_prq( prq, dir, copy )
  1234. XLINKPTR prq;
  1235. XCELLPTR dir;
  1236. Xint     copy;
  1237. X{
  1238. X   if( prq == NIL(LINK) ) return(prq);
  1239. X
  1240. X   if( copy ) {
  1241. X      LINKPTR tprq;
  1242. X
  1243. X      TALLOC( tprq, 1, LINK );
  1244. X      *tprq = *prq;
  1245. X      prq = tprq;
  1246. X   }
  1247. X
  1248. X   prq->cl_next = Explode_prq( prq->cl_next, dir, copy );
  1249. X   prq->cl_prq  = Explode_cell( prq->cl_prq, dir );
  1250. X
  1251. X   return( prq );
  1252. X}
  1253. SHAR_EOF
  1254. chmod 0440 unix/explode.c || echo "restore of unix/explode.c fails"
  1255. echo "x - extracting unix/dirbrk.c (Text)"
  1256. sed 's/^X//' << 'SHAR_EOF' > unix/dirbrk.c &&
  1257. X/* RCS      -- $Header: /u2/dvadura/src/generic/dmake/src/unix/RCS/dirbrk.c,v 1.1 90/07/19 14:04:37 dvadura Exp $
  1258. X-- SYNOPSIS -- define the directory separator string.
  1259. X-- 
  1260. X-- DESCRIPTION
  1261. X--     Define this string for any character that may appear in a path name
  1262. X--    and can be used as a directory separator.  Also provide a function
  1263. X--    to indicate if a given path begins at the root of the file system.
  1264. X--
  1265. X-- AUTHOR
  1266. X--      Dennis Vadura, dvadura@watdragon.uwaterloo.ca
  1267. X--      CS DEPT, University of Waterloo, Waterloo, Ont., Canada
  1268. X--
  1269. X-- COPYRIGHT
  1270. X--      Copyright (c) 1990 by Dennis Vadura.  All rights reserved.
  1271. X-- 
  1272. X--      This program is free software; you can redistribute it and/or
  1273. X--      modify it under the terms of the GNU General Public License
  1274. X--      (version 1), as published by the Free Software Foundation, and
  1275. X--      found in the file 'LICENSE' included with this distribution.
  1276. X-- 
  1277. X--      This program is distributed in the hope that it will be useful,
  1278. X--      but WITHOUT ANY WARRANTY; without even the implied warrant of
  1279. X--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1280. X--      GNU General Public License for more details.
  1281. X-- 
  1282. X--      You should have received a copy of the GNU General Public License
  1283. X--      along with this program;  if not, write to the Free Software
  1284. X--      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1285. X--
  1286. X-- LOG
  1287. X--     $Log:    dirbrk.c,v $
  1288. X * Revision 1.1  90/07/19  14:04:37  dvadura
  1289. X * Initial Revision of Version 3.5
  1290. X * 
  1291. X*/
  1292. X
  1293. X#include "extern.h"
  1294. X
  1295. X/* Unix only uses / */
  1296. Xchar*    DirBrkStr = "/";
  1297. X
  1298. X/*
  1299. X** Return TRUE if the name is the full specification of a path name to a file
  1300. X** starting at the root of the file system, otherwise return FALSE
  1301. X*/
  1302. Xint
  1303. XIf_root_path(name)
  1304. Xchar *name;
  1305. X{
  1306. X   return( strchr(DirBrkStr, *name) != NIL(char) );
  1307. X}
  1308. SHAR_EOF
  1309. chmod 0440 unix/dirbrk.c || echo "restore of unix/dirbrk.c fails"
  1310. echo "x - extracting unix/config.mk (Text)"
  1311. sed 's/^X//' << 'SHAR_EOF' > unix/config.mk &&
  1312. X# This is an OS specific configuration file
  1313. X#    It assumes that OBJDIR, TARGET and DEBUG are previously defined.
  1314. X#    It defines    CFLAGS, LDARGS, CPPFLAGS, STARTUPFILE, LDOBJS
  1315. X#            PRINTER, PRINTFLAGS
  1316. X#    It augments    SRC, OBJDIR, TARGET, CFLAGS, LDLIBS
  1317. X#
  1318. XPRINTER        = hw
  1319. XPRINTFLAGS    = -P$(PRINTER)
  1320. XSTARTUPFILE    = $(OS)/startup.mk
  1321. XCPPFLAGS     = $(CFLAGS)
  1322. XLDOBJS        = $(CSTARTUP) $(OBJDIR)/{$(<:f)}
  1323. XLDARGS        = $(LDFLAGS) -o $@ $(LDOBJS) $(LDLIBS)
  1324. X
  1325. X# Debug flags
  1326. XDB_CFLAGS    = -g -DDBUG
  1327. XDB_LDFLAGS    = -g
  1328. XDB_LDLIBS    =
  1329. X
  1330. X# NO Debug flags
  1331. XNDB_CFLAGS    = -O
  1332. XNDB_LDFLAGS    =
  1333. XNDB_LDLIBS    =
  1334. X
  1335. X# Local configuration modifications for CFLAGS.
  1336. XCFLAGS         += -I$(OS)
  1337. X
  1338. X# Sources that must be defined for each different version
  1339. XOSSRC := arlib.c dirbrk.c explode.c rmprq.c ruletab.c runargv.c
  1340. XSRC  += $(OSSRC)
  1341. X.SETDIR=$(OS) : $(OSSRC)
  1342. X
  1343. X# Set source dirs so that we can find files named in this
  1344. X# config file.
  1345. X.SOURCE.h : $(OS)
  1346. X
  1347. X# See if we modify anything in the lower levels.
  1348. X.IF $(OSRELEASE) != $(NULL)
  1349. X   .INCLUDE .IGNORE : $(OS)$(DIRSEPSTR)$(OSRELEASE)$(DIRSEPSTR)config.mk
  1350. SHAR_EOF
  1351. echo "End of part 1"
  1352. echo "File unix/config.mk is continued in part 2"
  1353. echo "2" > s2_seq_.tmp
  1354. exit 0
  1355.  
  1356.