home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume13 / gdiff-tc / part01 next >
Text File  |  1990-06-02  |  20KB  |  790 lines

  1. Newsgroups: comp.sources.misc
  2. organization: U of Wisconsin CS Dept
  3. subject: v13i024: GNU diff 1.14 patches for MSDOS Turbo C 2.0
  4. from: ward@sneezy.cs.wisc.edu (Michael Ward)
  5. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  6.  
  7. Posting-number: Volume 13, Issue 24
  8. Submitted-by: ward@sneezy.cs.wisc.edu (Michael Ward)
  9. Archive-name: gdiff-tc/part01
  10.  
  11. The following patches will allow GNU diff v1.14 to compile with Turbo C 2.0
  12. and run under MSDOS. I have only checked a couple of context and normal diffs,
  13. but it seems to work fine. One major restriction is that the files to be
  14. compared must both be less than 64K in size. Hope this is useful anyway.
  15.  
  16. Mike Ward
  17. ward@sneezy.cs.wisc.edu
  18.  
  19.     remove this header and then use patch to apply the diffs
  20.     if you don't have patch, there are not that many changes ...
  21.  
  22.  
  23. ---------- cut here --------------------------------------------------
  24. *** ../gnudiff/diff.h    Fri Feb 23 07:55:14 1990
  25. --- diff.h    Sat Jun 02 07:53:46 1990
  26. ***************
  27. *** 23,28 ****
  28. --- 23,43 ----
  29.   #include <sys/types.h>
  30.   #include <sys/stat.h>
  31.   
  32. + #ifdef TURBOC20
  33. + #define MEMSZ unsigned
  34. + #define MAXMEMBLK 65530L
  35. + #else
  36. + #define MEMSZ int
  37. + #endif
  38. + #ifdef TURBOC20
  39. + #include <stdlib.h>
  40. + #include <string.h>
  41. + #include <time.h>
  42. + #include <dir.h>
  43. + #include <fcntl.h>
  44. + #else
  45.   #ifdef USG
  46.   #include <time.h>
  47.   #ifdef HAVE_NDIR
  48. ***************
  49. *** 39,45 ****
  50. --- 54,69 ----
  51.   #include <sys/dir.h>
  52.   #include <sys/file.h>
  53.   #endif
  54. + #endif
  55.   
  56. + #ifdef TURBOC20
  57. + #define bcopy(s,d,n)    memcpy((d),(s),(n))
  58. + #define bcmp(s1,s2,n)    memcmp((s1),(s2),(n))
  59. + #define bzero(s,n)    memset((s),0,(n))
  60. + #define index    strchr
  61. + #define rindex    strrchr
  62. + #else
  63.   #ifdef USG
  64.   /* Define needed BSD functions in terms of sysV library.  */
  65.   
  66. ***************
  67. *** 53,58 ****
  68. --- 77,83 ----
  69.   #define index    strchr
  70.   #define rindex    strrchr
  71.   #endif
  72. + #endif
  73.   
  74.   #include <errno.h>
  75.   extern int      errno;
  76. ***************
  77. *** 229,237 ****
  78.       /* Buffer in which text of file is read.  */
  79.       char *        buffer;
  80.       /* Allocated size of buffer.  */
  81. !     int            bufsize;
  82.       /* Number of valid characters now in the buffer. */
  83. !     int            buffered_chars;
  84.   
  85.       /* Array of data on analyzed lines of this chunk of this file.  */
  86.       struct line_def *linbuf;
  87. --- 254,262 ----
  88.       /* Buffer in which text of file is read.  */
  89.       char *        buffer;
  90.       /* Allocated size of buffer.  */
  91. !     MEMSZ            bufsize;
  92.       /* Number of valid characters now in the buffer. */
  93. !     MEMSZ            buffered_chars;
  94.   
  95.       /* Array of data on analyzed lines of this chunk of this file.  */
  96.       struct line_def *linbuf;
  97. ***************
  98. *** 292,298 ****
  99.   
  100.   /* Describe the two files currently being compared.  */
  101.   
  102. ! struct file_data files[2];
  103.   
  104.   /* Queue up one-line messages to be printed at the end,
  105.      when -l is specified.  Each message is recorded with a `struct msg'.  */
  106. --- 317,323 ----
  107.   
  108.   /* Describe the two files currently being compared.  */
  109.   
  110. ! EXTERN struct file_data files[2];
  111.   
  112.   /* Queue up one-line messages to be printed at the end,
  113.      when -l is specified.  Each message is recorded with a `struct msg'.  */
  114. *** ../gnudiff/limits.h    Thu Mar 01 14:31:40 1990
  115. --- limits.h    Sat Jun 02 07:53:48 1990
  116. ***************
  117. *** 28,38 ****
  118.   #define USHRT_MAX 65535U
  119.   
  120.   /* Minimum and maximum values a `signed int' can hold.  */
  121. ! #define INT_MIN (-INT_MAX-1)
  122. ! #define INT_MAX 2147483647
  123.   
  124.   /* Maximum value an `unsigned int' can hold.  (Minimum is 0).  */
  125. ! #define UINT_MAX 4294967295U
  126.   
  127.   /* Minimum and maximum values a `signed long int' can hold.
  128.      (Same as `int').  */
  129. --- 28,38 ----
  130.   #define USHRT_MAX 65535U
  131.   
  132.   /* Minimum and maximum values a `signed int' can hold.  */
  133. ! #define INT_MIN (-32768)
  134. ! #define INT_MAX 32767
  135.   
  136.   /* Maximum value an `unsigned int' can hold.  (Minimum is 0).  */
  137. ! #define UINT_MAX 65535U
  138.   
  139.   /* Minimum and maximum values a `signed long int' can hold.
  140.      (Same as `int').  */
  141. *** ../gnudiff/analyze.c    Thu Mar 01 14:20:26 1990
  142. --- analyze.c    Sat Jun 02 07:53:56 1990
  143. ***************
  144. *** 655,660 ****
  145. --- 655,661 ----
  146.     int binary;
  147.     int changes;
  148.   
  149. + #ifndef TURBOC20
  150.     /* See if the two named files are actually the same physical file.
  151.        If so, we know they are identical without actually reading them.  */
  152.   
  153. ***************
  154. *** 661,666 ****
  155. --- 662,668 ----
  156.     if (filevec[0].stat.st_ino == filevec[1].stat.st_ino
  157.         && filevec[0].stat.st_dev == filevec[1].stat.st_dev)
  158.       return 0;
  159. + #endif
  160.   
  161.     binary = read_files (filevec);
  162.   
  163. *** ../gnudiff/diff.c    Sun Feb 18 17:29:34 1990
  164. --- diff.c    Sat Jun 02 07:53:56 1990
  165. ***************
  166. *** 260,269 ****
  167. --- 260,271 ----
  168.         ignore_regexp = optarg;
  169.         break;
  170.   
  171. + #ifndef TURBOC20
  172.       case 'l':
  173.         /* Pass the output through `pr' to paginate it.  */
  174.         paginate_flag = 1;
  175.         break;
  176. + #endif
  177.   
  178.       case 'n':
  179.         /* Output RCS-style diffs, like `-f' except that each command
  180. ***************
  181. *** 366,372 ****
  182.   
  183.     switch_string = option_list (argv + 1, optind - 1);
  184.   
  185. !   val = compare_files (0, argv[optind], 0, argv[optind + 1], 0);
  186.   
  187.     /* Print any messages that were saved up for last.  */
  188.     print_message_queue ();
  189. --- 368,374 ----
  190.   
  191.     switch_string = option_list (argv + 1, optind - 1);
  192.   
  193. !   val = compare_files (NULL, argv[optind], NULL, argv[optind + 1], 0);
  194.   
  195.     /* Print any messages that were saved up for last.  */
  196.     print_message_queue ();
  197. ***************
  198. *** 426,433 ****
  199.   
  200.     if (! entire_new_file_flag && (name0 == 0 || name1 == 0))
  201.       {
  202. !       char *name = name0 == 0 ? name1 : name0;
  203. !       char *dir = name0 == 0 ? dir1 : dir0;
  204.         message ("Only in %s: %s\n", dir, name);
  205.         /* Return 1 so that diff_dirs will return 1 ("some files differ").  */
  206.         return 1;
  207. --- 428,435 ----
  208.   
  209.     if (! entire_new_file_flag && (name0 == 0 || name1 == 0))
  210.       {
  211. !       char *name = name0 == NULL ? name1 : name0;
  212. !       char *dir = name0 == NULL ? dir1 : dir0;
  213.         message ("Only in %s: %s\n", dir, name);
  214.         /* Return 1 so that diff_dirs will return 1 ("some files differ").  */
  215.         return 1;
  216. ***************
  217. *** 435,452 ****
  218.   
  219.     /* Mark any nonexistent file with -1 in the desc field.  */
  220.   
  221. !   inf[0].desc = name0 == 0 ? -1 : 0;
  222. !   inf[1].desc = name1 == 0 ? -1 : 0;
  223.   
  224.     /* Now record the full name of each file, including nonexistent ones.  */
  225.   
  226. !   if (name0 == 0)
  227.       name0 = name1;
  228. !   if (name1 == 0)
  229.       name1 = name0;
  230.   
  231. !   inf[0].name = dir0 == 0 ? name0 : concat (dir0, "/", name0);
  232. !   inf[1].name = dir1 == 0 ? name1 : concat (dir1, "/", name1);
  233.   
  234.     /* Stat the files.  Record whether they are directories.
  235.        Record in stat_result whether stat fails.  */
  236. --- 437,454 ----
  237.   
  238.     /* Mark any nonexistent file with -1 in the desc field.  */
  239.   
  240. !   inf[0].desc = name0 == NULL ? -1 : 0;
  241. !   inf[1].desc = name1 == NULL ? -1 : 0;
  242.   
  243.     /* Now record the full name of each file, including nonexistent ones.  */
  244.   
  245. !   if (name0 == NULL)
  246.       name0 = name1;
  247. !   if (name1 == NULL)
  248.       name1 = name0;
  249.   
  250. !   inf[0].name = dir0 == NULL ? name0 : concat (dir0, "/", name0);
  251. !   inf[1].name = dir1 == NULL ? name1 : concat (dir1, "/", name1);
  252.   
  253.     /* Stat the files.  Record whether they are directories.
  254.        Record in stat_result whether stat fails.  */
  255. ***************
  256. *** 473,478 ****
  257. --- 475,481 ----
  258.       }
  259.       }
  260.   
  261. + #ifndef TURBOC20
  262.     /* See if the two named files are actually the same physical file.
  263.        If so, we know they are identical without actually reading them.  */
  264.   
  265. ***************
  266. *** 484,493 ****
  267.         val = 0;
  268.         goto done;
  269.       }
  270.   
  271. !   if (name0 == 0)
  272.       inf[0].dir_p = inf[1].dir_p;
  273. !   if (name1 == 0)
  274.       inf[1].dir_p = inf[0].dir_p;
  275.   
  276.     /* Open the files and record their descriptors.  */
  277. --- 487,497 ----
  278.         val = 0;
  279.         goto done;
  280.       }
  281. + #endif
  282.   
  283. !   if (name0 == NULL)
  284.       inf[0].dir_p = inf[1].dir_p;
  285. !   if (name1 == NULL)
  286.       inf[1].dir_p = inf[0].dir_p;
  287.   
  288.     /* Open the files and record their descriptors.  */
  289. ***************
  290. *** 646,654 ****
  291.     else
  292.       fflush (stdout);
  293.   
  294. !   if (dir0 != 0)
  295.       free (inf[0].name);
  296. !   if (dir1 != 0)
  297.       free (inf[1].name);
  298.   
  299.     return val;
  300. --- 650,658 ----
  301.     else
  302.       fflush (stdout);
  303.   
  304. !   if (dir0 != NULL)
  305.       free (inf[0].name);
  306. !   if (dir1 != NULL)
  307.       free (inf[1].name);
  308.   
  309.     return val;
  310. *** ../gnudiff/diff3.c    Fri Feb 23 07:57:34 1990
  311. --- diff3.c    Sat Jun 02 07:54:14 1990
  312. ***************
  313. *** 30,35 ****
  314. --- 30,43 ----
  315.   #include <stdio.h>
  316.   #include <ctype.h>
  317.   
  318. + #ifdef TURBOC20
  319. + #define bcopy(s,d,n)    memcpy((d),(s),(n))
  320. + #define bcmp(s1,s2,n)    memcmp((s1),(s2),(n))
  321. + #define bzero(s,n)    memset((s),0,(n))
  322. + #define index    strchr
  323. + #define rindex    strrchr
  324. + #else
  325.   #ifdef USG
  326.   #include <fcntl.h>
  327.   
  328. ***************
  329. *** 44,49 ****
  330. --- 52,58 ----
  331.   #define vfork    fork
  332.   #define index    strchr
  333.   #define rindex    strrchr
  334. + #endif
  335.   #endif
  336.   /*
  337.    * Internal data structures and macros for the diff3 program; includes
  338. *** ../gnudiff/dir.c    Thu Nov 16 11:10:46 1989
  339. --- dir.c    Sat Jun 02 07:54:18 1990
  340. ***************
  341. *** 36,43 ****
  342. --- 36,51 ----
  343.        char *dirname;
  344.        int nonex;
  345.   {
  346. + #ifdef TURBOC20
  347. +   int err;
  348. +   char *name;
  349. +   struct ffblk info;
  350. +   struct ffblk *next = &info;
  351. + #else
  352.     register DIR *reading;
  353.     register struct direct *next;
  354. + #endif
  355.     struct dirdata dirdata;
  356.   
  357.     /* Address of block containing the files that are described.  */
  358. ***************
  359. *** 49,54 ****
  360. --- 57,63 ----
  361.     /* Index of first unused in `files'.  */
  362.     int files_index;
  363.   
  364.     if (nonex)
  365.       {
  366.         dirdata.length = 0;
  367. ***************
  368. *** 56,61 ****
  369. --- 65,78 ----
  370.         return dirdata;
  371.       }
  372.   
  373. + #ifdef TURBOC20
  374. +   name = (char *) xmalloc (strlen (dirname) + 4);
  375. +   strcpy(name,dirname);
  376. +   if (strlen(name) && name[strlen(name)-1]!='/') strcat(name,"/");
  377. +   strcat(name,"*.*");
  378. +   err = findfirst(name,next,0x3f);
  379. +   free(name);
  380. + #else
  381.     /* Open the directory and check for errors.  */
  382.     reading = opendir (dirname);
  383.     if (!reading)
  384. ***************
  385. *** 64,69 ****
  386. --- 81,87 ----
  387.         dirdata.length = -1;
  388.         return dirdata;
  389.       }
  390. + #endif
  391.   
  392.     /* Initialize the table of filenames.  */
  393.   
  394. ***************
  395. *** 74,79 ****
  396. --- 92,118 ----
  397.     /* Read the directory entries, and insert the subfiles
  398.        into the `files' table.  */
  399.   
  400. + #ifdef TURBOC20
  401. +   while (!err)
  402. +     {
  403. +       /* Ignore the files `.' and `..' */
  404. +       if (next->ff_name[0] == '.'
  405. +       && (next->ff_name[1] == 0
  406. +           || (next->ff_name[1] == '.'
  407. +           && next->ff_name[2] == 0)))
  408. +     continue;
  409. +       if (files_index == nfiles)
  410. +     {
  411. +       nfiles *= 2;
  412. +       files
  413. +         = (char **) xrealloc (files, sizeof (char *) * nfiles);
  414. +     }
  415. +       strlwr(next->ff_name);
  416. +       files[files_index++] = concat (next->ff_name, "", "");
  417. +       err = findnext(next);
  418. +     }
  419. + #else
  420.     while (next = readdir (reading))
  421.       {
  422.         /* Ignore the files `.' and `..' */
  423. ***************
  424. *** 93,98 ****
  425. --- 132,138 ----
  426.       }
  427.   
  428.     closedir (reading);
  429. + #endif
  430.   
  431.     /* Sort the table.  */
  432.     qsort (files, files_index, sizeof (char *), compare_names);
  433. *** ../gnudiff/getopt.c    Thu Mar 01 10:53:00 1990
  434. --- getopt.c    Sat Jun 02 07:54:24 1990
  435. ***************
  436. *** 32,37 ****
  437. --- 32,41 ----
  438.   #include <stdio.h>
  439.   
  440.   /* If compiled with GNU C, use the built-in alloca */
  441. + #ifdef TURBOC20
  442. + char *xmalloc ();
  443. + #define alloca(x) xmalloc(x)
  444. + #else
  445.   #ifdef __GNUC__
  446.   #define alloca __builtin_alloca
  447.   #else /* not __GNUC__ */
  448. ***************
  449. *** 41,50 ****
  450. --- 45,60 ----
  451.   char *alloca ();
  452.   #endif
  453.   #endif /* not __GNUC__ */
  454. + #endif
  455.   
  456. + #ifdef TURBOC20
  457. + #define bcopy(s, d, l) memcpy((d), (s), (l))
  458. + #define index strchr
  459. + #else
  460.   #ifdef USG
  461.   #define bcopy(s, d, l) memcpy((d), (s), (l))
  462.   #define index strchr
  463. + #endif
  464.   #endif
  465.   
  466.   char *getenv ();
  467. *** ../gnudiff/io.c    Sun Dec 24 08:03:12 1989
  468. --- io.c    Sat Jun 02 07:54:30 1990
  469. ***************
  470. *** 68,83 ****
  471.        and one for a sentinel in find_identical_ends.  */
  472.     else if ((current->stat.st_mode & S_IFMT) == S_IFREG)
  473.       {
  474.         current->bufsize = current->stat.st_size;
  475.         current->buffer = (char *) xmalloc (current->bufsize + 2);
  476.         current->buffered_chars
  477.       = read (current->desc, current->buffer, current->bufsize);
  478. !       if (current->buffered_chars < 0)
  479.       pfatal_with_name (current->name);
  480.       }
  481.     else
  482.       {
  483. !       int cc;
  484.   
  485.         current->bufsize = 4096;
  486.         current->buffer = (char *) xmalloc (current->bufsize + 2);
  487. --- 68,87 ----
  488.        and one for a sentinel in find_identical_ends.  */
  489.     else if ((current->stat.st_mode & S_IFMT) == S_IFREG)
  490.       {
  491. + #ifdef TURBOC20
  492. +       if (current->stat.st_size > MAXMEMBLK)
  493. +         pfatal_with_name("file too large!");
  494. + #endif
  495.         current->bufsize = current->stat.st_size;
  496.         current->buffer = (char *) xmalloc (current->bufsize + 2);
  497.         current->buffered_chars
  498.       = read (current->desc, current->buffer, current->bufsize);
  499. !       if (current->buffered_chars == (MEMSZ)-1)
  500.       pfatal_with_name (current->name);
  501.       }
  502.     else
  503.       {
  504. !       MEMSZ cc;
  505.   
  506.         current->bufsize = 4096;
  507.         current->buffer = (char *) xmalloc (current->bufsize + 2);
  508. ***************
  509. *** 88,104 ****
  510.         while ((cc = read (current->desc,
  511.                current->buffer + current->buffered_chars,
  512.                current->bufsize - current->buffered_chars))
  513. !          > 0)
  514.       {
  515.         current->buffered_chars += cc;
  516.         if (current->buffered_chars == current->bufsize)
  517.           {
  518.             current->bufsize = current->bufsize * 2;
  519.             current->buffer = (char *) xrealloc (current->buffer,
  520.                              current->bufsize + 2);
  521.           }
  522.       }
  523. !       if (cc < 0)
  524.       pfatal_with_name (current->name);
  525.       }
  526.     
  527. --- 92,112 ----
  528.         while ((cc = read (current->desc,
  529.                current->buffer + current->buffered_chars,
  530.                current->bufsize - current->buffered_chars))
  531. !          != (MEMSZ)-1 && cc != 0)
  532.       {
  533.         current->buffered_chars += cc;
  534.         if (current->buffered_chars == current->bufsize)
  535.           {
  536. + #ifdef TURBOC20
  537. +               if (2L * (long)(current->bufsize) > MAXMEMBLK)
  538. +                 pfatal_with_name("file too large!");
  539. + #endif
  540.             current->bufsize = current->bufsize * 2;
  541.             current->buffer = (char *) xrealloc (current->buffer,
  542.                              current->bufsize + 2);
  543.           }
  544.       }
  545. !       if (cc == (MEMSZ)-1)
  546.       pfatal_with_name (current->name);
  547.       }
  548.     
  549. *** ../gnudiff/regex.c    Mon Jan 08 09:33:40 1990
  550. --- regex.c    Sat Jun 02 07:54:46 1990
  551. ***************
  552. *** 32,37 ****
  553. --- 32,42 ----
  554.   
  555.   #else  /* not emacs */
  556.   
  557. + #ifdef TURBOC20
  558. + #define bcopy(s,d,n)    memcpy((d),(s),(n))
  559. + #define bcmp(s1,s2,n)    memcmp((s1),(s2),(n))
  560. + #define bzero(s,n)    memset((s),0,(n))
  561. + #else
  562.   #ifdef USG
  563.   #ifndef BSTRING
  564.   #define bcopy(s,d,n)    memcpy((d),(s),(n))
  565. ***************
  566. *** 39,49 ****
  567. --- 44,59 ----
  568.   #define bzero(s,n)    memset((s),0,(n))
  569.   #endif
  570.   #endif
  571. + #endif
  572.   
  573.   char *malloc ();
  574.   char *realloc ();
  575.   
  576.   /* Make alloca work the best possible way.  */
  577. + #ifdef TURBOC20
  578. + char *xmalloc ();
  579. + #define alloca(x) xmalloc(x)
  580. + #else
  581.   #ifdef __GNUC__
  582.   #define alloca __builtin_alloca
  583.   #else
  584. ***************
  585. *** 51,56 ****
  586. --- 61,67 ----
  587.   #include <alloca.h>
  588.   #else
  589.   char *alloca ();
  590. + #endif
  591.   #endif
  592.   #endif
  593.   
  594. *** ../gnudiff/util.c    Fri Feb 23 07:56:12 1990
  595. --- util.c    Sat Jun 02 07:54:52 1990
  596. ***************
  597. *** 129,134 ****
  598. --- 129,135 ----
  599.     strcat (name, " ");
  600.     strcat (name, name1);
  601.   
  602. + #ifndef TURBOC20  
  603.     if (paginate_flag)
  604.       {
  605.         int pipes[2];
  606. ***************
  607. *** 161,166 ****
  608. --- 162,168 ----
  609.       } 
  610.       }
  611.     else
  612. + #endif
  613.       {
  614.   
  615.         /* If -l was not specified, output the diff straight to `stdout'.  */
  616. ***************
  617. *** 182,192 ****
  618. --- 184,196 ----
  619.   void
  620.   finish_output ()
  621.   {
  622. + #ifndef TURBOC20
  623.     if (outfile != stdout)
  624.       {
  625.         fclose (outfile);
  626.         wait (0);
  627.       }
  628. + #endif
  629.   }
  630.   
  631.   /* Compare two lines (typically one from each input file)
  632. *** ../gnudiff/makefile    Sun Feb 18 19:11:30 1990
  633. --- makefile    Sat Jun 02 07:54:56 1990
  634. ***************
  635. *** 1,4 ****
  636. ! # Makefile for GNU DIFF
  637.   # Copyright (C) 1988, 1989 Free Software Foundation, Inc.
  638.   
  639.   # This file is part of GNU DIFF.
  640. --- 1,4 ----
  641. ! # Turbo C Makefile for GNU DIFF
  642.   # Copyright (C) 1988, 1989 Free Software Foundation, Inc.
  643.   
  644.   # This file is part of GNU DIFF.
  645. ***************
  646. *** 21,29 ****
  647.   # You can compile this with ordinary cc as well,
  648.   # but gcc makes it faster.
  649.   # Also, gcc supports -O and -g together.
  650. ! CC=gcc -O
  651. ! CFLAGS = -g
  652. ! INSTALL = install
  653.   
  654.   # On system V, enable these three lines:
  655.   # CFLAGS = -g -DUSG
  656. --- 21,28 ----
  657.   # You can compile this with ordinary cc as well,
  658.   # but gcc makes it faster.
  659.   # Also, gcc supports -O and -g together.
  660. ! CC=tcc
  661. ! CFLAGS = -A -N -v -1 -ml -DTURBOC20
  662.   
  663.   # On system V, enable these three lines:
  664.   # CFLAGS = -g -DUSG
  665. ***************
  666. *** 36,95 ****
  667.   # Add -DHAVE_DIRECT to CFLAGS if your system uses 'struct direct' instead of
  668.   # 'struct dirent' (this is the case at least with one add-on ndir library).
  669.   
  670. - bindir=/usr/local/bin
  671. - prefix=
  672. - # All source files
  673.   srcs=diff.c analyze.c io.c context.c ed.c normal.c ifdef.c util.c dir.c \
  674. !     version.c diff.h regex.c regex.h limits.h diff3.c \
  675. !     getopt.c getopt1.c getopt.h
  676. ! # Object files for diff only.
  677. ! objs=$(archpfx)diff.o $(archpfx)analyze.o $(archpfx)io.o $(archpfx)context.o \
  678. !      $(archpfx)ed.o $(archpfx)normal.o $(archpfx)util.o $(archpfx)dir.o \
  679. !      $(archpfx)regex.o $(archpfx)ifdef.o $(archpfx)version.o \
  680. !      $(archpfx)getopt.o $(archpfx)getopt1.o
  681. ! tapefiles = $(srcs) README diagmeet.note Makefile COPYING ChangeLog
  682. ! all: $(archpfx)diff $(archpfx)diff3
  683. ! $(archpfx)diff3: $(archpfx)diff3.o
  684. !     $(CC) -o $(archpfx)diff3 $(CFLAGS) $(LDFLAGS) $(archpfx)diff3.o $(LIBS)
  685. ! $(archpfx)diff: $(objs)
  686. !     $(CC) -o $(archpfx)diff $(CFLAGS) $(LDFLAGS) $(objs) $(LIBS)
  687. ! $(objs): diff.h
  688. ! $(archpfx)context.o $(archpfx)diff.o: regex.h
  689. ! $(archpfx)diff3.o: diff3.c
  690. !     $(CC) -c $(CFLAGS) -DDIFF_PROGRAM=\"$(bindir)/diff\" diff3.c \
  691. !  $(OUTPUT_OPTION)
  692. ! clean:
  693. !     rm -f *.o $(archpfx)diff $(archpfx)diff3 diff.tar diff.tar.Z
  694. ! install: install-diff install-diff3
  695. ! install-diff: $(prefix)$(bindir)/diff
  696. ! $(prefix)$(bindir)/diff: $(archpfx)diff
  697. !     $(INSTALL) $(archpfx)diff $(prefix)$(bindir)/diff
  698. ! install-diff3: $(prefix)$(bindir)/diff3
  699. ! $(prefix)$(bindir)/diff3: $(archpfx)diff3
  700. !     $(INSTALL) $(archpfx)diff3 $(prefix)$(bindir)/diff3
  701. ! diff.tar: $(tapefiles)
  702. !     mkdir tmp
  703. !     mkdir tmp/diff
  704. !     -ln $(tapefiles) tmp/diff
  705. !     for file in $(tapefiles); do \
  706. !         if [ ! -r tmp/diff/$$file ]; then cp $$file tmp/diff; fi \
  707. !     done
  708. !     cd tmp; tar cf ../diff.tar diff
  709. !     rm -rf tmp
  710.   
  711. ! diff.tar.Z: diff.tar
  712. !     compress < diff.tar > diff.tar.Z
  713. --- 35,88 ----
  714.   # Add -DHAVE_DIRECT to CFLAGS if your system uses 'struct direct' instead of
  715.   # 'struct dirent' (this is the case at least with one add-on ndir library).
  716.   
  717.   srcs=diff.c analyze.c io.c context.c ed.c normal.c ifdef.c util.c dir.c \
  718. !     version.c diff.h regex.c regex.h limits.h diff3.c getopt.c \
  719. !     getopt1.c getopt.h
  720. ! allobj=analyze.obj io.obj ed.obj normal.obj util.obj dir.obj regex.obj \
  721. !     ifdef.obj version.obj getopt.obj getopt1.obj context.obj diff.obj
  722. ! .h.obj:
  723. !     $(CC) -c $(CFLAGS) $(LDFLAGS) $*
  724. ! .c.obj:
  725. !     $(CC) -c $(CFLAGS) $(LDFLAGS) $*
  726. ! # all: diff.exe diff3.exe
  727. ! all: diff.exe
  728. ! diff3.exe: diff3.obj getopt.obj
  729. !     $(CC) -ediff3 $(CFLAGS) $(LDFLAGS) diff3.obj getopt.obj
  730. ! diff.exe: $(allobj)
  731. !     $(CC) -ediff $(CFLAGS) $(LDFLAGS) *.obj
  732. ! analyze.obj: diff.h analyze.c
  733. ! io.obj: diff.h io.c
  734. ! ed.obj: diff.h ed.c
  735. ! normal.obj: diff.h normal.c
  736. ! util.obj: diff.h util.c
  737. ! dir.obj: diff.h dir.c
  738. ! regex.obj: diff.h regex.c
  739. ! ifdef.obj: diff.h ifdef.c
  740. ! version.obj: diff.h version.c
  741. ! getopt.obj: diff.h getopt.c
  742. ! getopt1.obj: diff.h getopt1.c
  743. ! context.obj: regex.h diff.h context.c
  744. ! diff.obj: regex.h diff.h diff.c
  745.   
  746. ! diff3.obj: diff3.c
  747. !     $(CC) -c $(CFLAGS) -DDIFF_PROGRAM="\"diff\"" diff3.c
  748.  
  749.