delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/02/13/09:58:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Sun, 13 Feb 2005 09:57:25 -0500
Message-Id: <200502131457.j1DEvPSS022036@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: fdonahoe AT wilkes DOT edu
CC: djgpp AT delorie DOT com
In-reply-to: <1108295498.420f3f4ad4276@webmail.wilkes.edu>
(fdonahoe AT wilkes DOT edu)
Subject: Re: src/rmake.bat LOST
References: <1108295498 DOT 420f3f4ad4276 AT webmail DOT wilkes DOT edu>
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

The only thing in cvs is src/rmake.cc

/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glob.h>
#include <process.h>
#include <unistd.h>

int
main(int argc, char **argv)
{
  int i;
  char cwd[200];
  char path[200], *pathp;
  char file[200];
  FILE *oi = fopen("makefile.oi", "w");
  FILE *rf = fopen("makefile.rf2", "w");

  getcwd(cwd, 200);

  argv[0] = "make";

  glob_t makefile_list;
  glob(".../makefile", 0, 0, &makefile_list);

  for (i = 0; i<makefile_list.gl_pathc; i++)
  {
    char *mf = makefile_list.gl_pathv[i];
    strcpy(path, mf);
    char *lsl = strrchr(path, '/');
    if (lsl) *lsl = 0;

    if (strcmp(mf, "makefile") == 0)
      continue;

    printf("--------------------------------------- Making in %s\n", path);

    sprintf(file, "%s/%s", cwd, path);
    if (chdir(file))
    {
      printf("Cannot chdir to %s\n", file);
      continue;
    }
    if (spawnvp(P_WAIT, "make", argv))
      exit(1);

    FILE *oh = fopen("makefile.oh", "r");
    if (oh)
    {
      int last_was_nl = 1;
      int ch;

      while ((ch = fgetc(oh)) != EOF)
      {
	if (ch != '\n' && last_was_nl)
	  fprintf(oi, "OBJS += ");
	last_was_nl = (ch == '\n');
	if (ch == '&')
	{
	  fprintf(oi, "%s", path);
	  fprintf(rf, "%s", path);
	}
	else
	{
	  fputc(ch, oi);
	  fputc(ch, rf);
	}
      }
      fclose(oh);
    }
  }
  fclose(rf);
  fclose(oi);

  chdir(cwd);

  spawnlp(P_WAIT, "update", "update", "makefile.rf2", "makefile.rf", 0);
  remove("makefile.rf2");

  if (spawnvp(P_WAIT, "make", argv))
    exit(1);

  return 0;
}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019