| 1 | # | 
|---|
| 2 |  | 
|---|
| 3 | # Define for DOS/WIN (not including DJGPP): | 
|---|
| 4 | #OBJEXT = obj | 
|---|
| 5 | #EXEEXT = .exe | 
|---|
| 6 | EXEEXT = | 
|---|
| 7 | OBJEXT = o | 
|---|
| 8 |  | 
|---|
| 9 | # Source of grep. | 
|---|
| 10 | OBJS = \ | 
|---|
| 11 | dfa.$(OBJEXT) \ | 
|---|
| 12 | grep.$(OBJEXT) \ | 
|---|
| 13 | kwset.$(OBJEXT) \ | 
|---|
| 14 | search.$(OBJEXT) | 
|---|
| 15 |  | 
|---|
| 16 | # Supporting routines. | 
|---|
| 17 | LIB_OBJS_core =  \ | 
|---|
| 18 | $(libdir)/closeout.$(OBJEXT) \ | 
|---|
| 19 | $(libdir)/error.$(OBJEXT) \ | 
|---|
| 20 | $(libdir)/exclude.$(OBJEXT) \ | 
|---|
| 21 | $(libdir)/hard-locale.$(OBJEXT) \ | 
|---|
| 22 | $(libdir)/isdir.$(OBJEXT) \ | 
|---|
| 23 | $(libdir)/quotearg.$(OBJEXT) \ | 
|---|
| 24 | $(libdir)/regex.$(OBJEXT) \ | 
|---|
| 25 | $(libdir)/savedir.$(OBJEXT) \ | 
|---|
| 26 | $(libdir)/strtoumax.$(OBJEXT) \ | 
|---|
| 27 | $(libdir)/xmalloc.$(OBJEXT) \ | 
|---|
| 28 | $(libdir)/xstrtol.$(OBJEXT) \ | 
|---|
| 29 | $(libdir)/xstrtoumax.$(OBJEXT) | 
|---|
| 30 |  | 
|---|
| 31 | # Comment out functions already supported as needed. | 
|---|
| 32 | #LIB_OBJ_atexit   =  $(libdir)/atexit.$(OBJEXT) | 
|---|
| 33 | #LIB_OBJ_alloca   =  $(libdir)/alloca.$(OBJEXT) | 
|---|
| 34 | #LIB_OBJ_fnmatch  =  $(libdir)/fnmatch.$(OBJEXT) | 
|---|
| 35 | LIB_OBJ_getopt   =  $(libdir)/getopt.$(OBJEXT) $(libdir)/getopt1.$(OBJEXT) | 
|---|
| 36 | #LIB_OBJ_memchr   =  $(libdir)/memchr.$(OBJEXT) | 
|---|
| 37 | LIB_OBJ_obstack  =  $(libdir)/obstack.$(OBJEXT) | 
|---|
| 38 | #LIB_OBJ_strtoul  =  $(libdir)/strtoul.$(OBJEXT) | 
|---|
| 39 | LIB_OBJ_stpcpy   =  $(libdir)/stpcpy.$(OBJEXT) | 
|---|
| 40 | LIB_OBJ_strtoull = $(libdir)/strtoull.$(OBJEXT) | 
|---|
| 41 |  | 
|---|
| 42 | LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_atexit) $(LIB_OBJ_alloca) \ | 
|---|
| 43 | $(LIB_OBJ_fnmatch) $(LIB_OBJ_getopt) $(LIB_OBJ_memchr) \ | 
|---|
| 44 | $(LIB_OBJ_obstack) $(LIB_OBJ_strtoul) $(LIB_OBJ_stpcpy) \ | 
|---|
| 45 | $(LIB_OBJ_strtoull) | 
|---|
| 46 |  | 
|---|
| 47 | # For Linux | 
|---|
| 48 | #LIB_OBJS = $(LIB_OBJS_core) | 
|---|
| 49 |  | 
|---|
| 50 | # For QNX/Neutrino | 
|---|
| 51 | #LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_getopt) $(LIB_OBJ_obstack) \ | 
|---|
| 52 | #            $(LIB_OBJ_stpcpy) $(LIB_OBJ_strtoull) | 
|---|
| 53 |  | 
|---|
| 54 | # Where is DIR and opendir/readdir defined. | 
|---|
| 55 | #  or -DHAVE_DIRENT_H | 
|---|
| 56 | #  or -DHAVE_SYS_NDIR_H | 
|---|
| 57 | #  or -DHAVE_SYS_DIR_H | 
|---|
| 58 | #  or -DHAVE_NDIR_H | 
|---|
| 59 | # | 
|---|
| 60 | # undef HAVE_STRERROR if lacking strerror() | 
|---|
| 61 | # undef HAVE_MEMCHR if lacking memchr() | 
|---|
| 62 | # | 
|---|
| 63 |  | 
|---|
| 64 | # default dry run | 
|---|
| 65 | DEFS_core = \ | 
|---|
| 66 | -DSTDC_HEADERS  \ | 
|---|
| 67 | -DHAVE_MEMCHR \ | 
|---|
| 68 | -DHAVE_DIRENT_H \ | 
|---|
| 69 | -DHAVE_STRERROR \ | 
|---|
| 70 | -Dconst= \ | 
|---|
| 71 | -Dsize_t=unsigned \ | 
|---|
| 72 | -Duintmax_t=long | 
|---|
| 73 |  | 
|---|
| 74 | # SunOS-4.1.x k&r cc | 
|---|
| 75 | #DEFS_sunos =  -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -Dconst= | 
|---|
| 76 |  | 
|---|
| 77 | # Solaris | 
|---|
| 78 | #DEFS_solaris = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -DHAVE_STRERROR | 
|---|
| 79 |  | 
|---|
| 80 | # DOS/WIN (change also OBJEXT/EXEEXT, see above) | 
|---|
| 81 | # DOS/DJGPP | 
|---|
| 82 | DEFS_dos = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_STRERROR -DHAVE_DIRENT_H \ | 
|---|
| 83 | -DHAVE_DOS_FILE_CONTENTS \ | 
|---|
| 84 | -DHAVE_DOS_FILE_NAMES -DHAVE_UNISTD_H -DHAVE_SETMODE | 
|---|
| 85 |  | 
|---|
| 86 | # If support ANSI C prototypes | 
|---|
| 87 | DEFS_ansi_c = -DPROTOTYPES | 
|---|
| 88 |  | 
|---|
| 89 | # No wchar support | 
|---|
| 90 | # DEFS_wchar = -DUSE_WIDE_CHAR -DHAVE_WCHAR_H | 
|---|
| 91 | DEFS_wchar = -Dwchar_t=int -Dmbstate_t=int | 
|---|
| 92 |  | 
|---|
| 93 | # Is strtol() and strtoul()  declarared ? | 
|---|
| 94 | #DEFS_strtol = -DHAVE_DECL_STRTOULL=0 -DHAVE_DECL_STRTOUL=0 | 
|---|
| 95 | DEFS_strtol = -DHAVE_DECL_STRTOULL=1 -DHAVE_DECL_STRTOUL=1 | 
|---|
| 96 |  | 
|---|
| 97 | # Define if malloc(0)/realloc(0) works | 
|---|
| 98 | #DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=0 \ | 
|---|
| 99 | #             -DHAVE_DONE_WORKING_REALLOC_CHECK=0 | 
|---|
| 100 | DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=1 \ | 
|---|
| 101 | -DHAVE_DONE_WORKING_REALLOC_CHECK=1 | 
|---|
| 102 |  | 
|---|
| 103 | DEFS = $(DEFS_core) $(DEFS_ansi_c) $(DEFS_wchar) $(DEFS_strtol) $(DEFS_alloc) \ | 
|---|
| 104 | -DHAVE_DECL_STRERROR_R=0 -DHAVE_VPRINTF -DCHAR_BIT=8 | 
|---|
| 105 |  | 
|---|
| 106 |  | 
|---|
| 107 | #### | 
|---|
| 108 |  | 
|---|
| 109 | CFLAGS = $(DEFS) -I. -I.. -I$(libdir) -DVERSION=\"bootstrap\" -DPACKAGE=\"grep\" | 
|---|
| 110 |  | 
|---|
| 111 | libdir = ../lib | 
|---|
| 112 |  | 
|---|
| 113 | PROGS = grep$(EXEEXT) egrep$(EXEEXT) fgrep$(EXEEXT) | 
|---|
| 114 |  | 
|---|
| 115 | libgreputils_a = $(libdir)/libgreputils.a | 
|---|
| 116 |  | 
|---|
| 117 | all : $(libgreputils_a) $(PROGS) | 
|---|
| 118 |  | 
|---|
| 119 | grep$(EXEEXT)  : $(OBJS)  grepmat.$(OBJEXT) $(libgreputils_a) | 
|---|
| 120 | $(CC) $(OBJS) grepmat.$(OBJEXT) -o grep $(libgreputils_a) | 
|---|
| 121 |  | 
|---|
| 122 | egrep$(EXEEXT) : $(OBJS) egrepmat.$(OBJEXT) $(libgreputils_a) | 
|---|
| 123 | $(CC) $(OBJS) egrepmat.$(OBJEXT) -o egrep $(libgreputils_a) | 
|---|
| 124 |  | 
|---|
| 125 | fgrep$(EXEEXT) : $(OBJS) fgrepmat.$(OBJEXT) $(libgreputils_a) | 
|---|
| 126 | $(CC) $(OBJS) fgrepmat.$(OBJEXT) -o fgrep $(libgreputils_a) | 
|---|
| 127 |  | 
|---|
| 128 | $(libgreputils_a) : $(LIB_OBJS) | 
|---|
| 129 | $(AR) $(ARFLAGS) $(libgreputils_a) $(LIB_OBJS) | 
|---|
| 130 |  | 
|---|
| 131 | clean : | 
|---|
| 132 | $(RM) grepmat.$(OBJEXT) egrepmat.$(OBJEXT) fgrepmat.$(OBJEXT) | 
|---|
| 133 | $(RM) $(OBJS) | 
|---|
| 134 | $(RM) $(PROGS) | 
|---|
| 135 | $(RM) $(libgreputils_a) $(LIB_OBJS) | 
|---|