1 | # Copyright 1997-1998, 2005-2012 Free Software Foundation, Inc.
|
---|
2 | #
|
---|
3 | # This program is free software; you can redistribute it and/or modify
|
---|
4 | # it under the terms of the GNU General Public License as published by
|
---|
5 | # the Free Software Foundation; either version 3, or (at your option)
|
---|
6 | # any later version.
|
---|
7 | #
|
---|
8 | # This program is distributed in the hope that it will be useful,
|
---|
9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
11 | # GNU General Public License for more details.
|
---|
12 | #
|
---|
13 | # You should have received a copy of the GNU General Public License
|
---|
14 | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
15 |
|
---|
16 | # Define for DOS/WIN (not including DJGPP):
|
---|
17 | #OBJEXT = obj
|
---|
18 | #EXEEXT = .exe
|
---|
19 | EXEEXT =
|
---|
20 | OBJEXT = o
|
---|
21 |
|
---|
22 | # Source of grep.
|
---|
23 | grep_OBJS = \
|
---|
24 | grep.$(OBJEXT) \
|
---|
25 | search.$(OBJEXT) \
|
---|
26 | kwset.$(OBJEXT) \
|
---|
27 | dfa.$(OBJEXT)
|
---|
28 | egrep_OBJS = \
|
---|
29 | egrep.$(OBJEXT) \
|
---|
30 | esearch.$(OBJEXT) \
|
---|
31 | kwset.$(OBJEXT) \
|
---|
32 | dfa.$(OBJEXT)
|
---|
33 | fgrep_OBJS = \
|
---|
34 | fgrep.$(OBJEXT) \
|
---|
35 | fsearch.$(OBJEXT) \
|
---|
36 | kwset.$(OBJEXT)
|
---|
37 |
|
---|
38 | # Supporting routines.
|
---|
39 | LIB_OBJS_core = \
|
---|
40 | $(libdir)/closeout.$(OBJEXT) \
|
---|
41 | $(libdir)/error.$(OBJEXT) \
|
---|
42 | $(libdir)/exclude.$(OBJEXT) \
|
---|
43 | $(libdir)/hard-locale.$(OBJEXT) \
|
---|
44 | $(libdir)/quotearg.$(OBJEXT) \
|
---|
45 | $(libdir)/regex.$(OBJEXT) \
|
---|
46 | $(libdir)/strtoumax.$(OBJEXT) \
|
---|
47 | $(libdir)/xmalloc.$(OBJEXT) \
|
---|
48 | $(libdir)/xstrtol.$(OBJEXT) \
|
---|
49 | $(libdir)/xstrtoumax.$(OBJEXT)
|
---|
50 |
|
---|
51 | # Comment out functions already supported as needed.
|
---|
52 | #LIB_OBJ_atexit = $(libdir)/atexit.$(OBJEXT)
|
---|
53 | #LIB_OBJ_alloca = $(libdir)/alloca.$(OBJEXT)
|
---|
54 | #LIB_OBJ_fnmatch = $(libdir)/fnmatch.$(OBJEXT)
|
---|
55 | LIB_OBJ_getopt = $(libdir)/getopt.$(OBJEXT) $(libdir)/getopt1.$(OBJEXT)
|
---|
56 | #LIB_OBJ_memchr = $(libdir)/memchr.$(OBJEXT)
|
---|
57 | LIB_OBJ_obstack = $(libdir)/obstack.$(OBJEXT)
|
---|
58 | #LIB_OBJ_strtoul = $(libdir)/strtoul.$(OBJEXT)
|
---|
59 |
|
---|
60 | LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_atexit) $(LIB_OBJ_alloca) \
|
---|
61 | $(LIB_OBJ_fnmatch) $(LIB_OBJ_getopt) $(LIB_OBJ_memchr) \
|
---|
62 | $(LIB_OBJ_obstack) $(LIB_OBJ_strtoul)
|
---|
63 |
|
---|
64 | # For Linux
|
---|
65 | #LIB_OBJS = $(LIB_OBJS_core)
|
---|
66 |
|
---|
67 | # For QNX/Neutrino
|
---|
68 | #LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_getopt) $(LIB_OBJ_obstack)
|
---|
69 |
|
---|
70 | # Where is DIR and opendir/readdir defined.
|
---|
71 | # or -DHAVE_DIRENT_H
|
---|
72 | # or -DHAVE_SYS_NDIR_H
|
---|
73 | # or -DHAVE_SYS_DIR_H
|
---|
74 | # or -DHAVE_NDIR_H
|
---|
75 | #
|
---|
76 | # undef HAVE_STRERROR if lacking strerror()
|
---|
77 | # undef HAVE_MEMCHR if lacking memchr()
|
---|
78 | #
|
---|
79 |
|
---|
80 | # default dry run
|
---|
81 | DEFS_core = \
|
---|
82 | -DSTDC_HEADERS \
|
---|
83 | -DHAVE_MEMCHR \
|
---|
84 | -DHAVE_DIRENT_H \
|
---|
85 | -DHAVE_STRERROR \
|
---|
86 | -Dconst= \
|
---|
87 | -Duintmax_t=long
|
---|
88 |
|
---|
89 | # SunOS-4.1.x k&r cc
|
---|
90 | #DEFS_sunos = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -Dconst=
|
---|
91 |
|
---|
92 | # Solaris
|
---|
93 | #DEFS_solaris = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -DHAVE_STRERROR
|
---|
94 |
|
---|
95 | # DOS/WIN (change also OBJEXT/EXEEXT, see above)
|
---|
96 | # DOS/DJGPP
|
---|
97 | DEFS_dos = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_STRERROR -DHAVE_DIRENT_H \
|
---|
98 | -DHAVE_DOS_FILE_CONTENTS \
|
---|
99 | -DHAVE_DOS_FILE_NAMES -DHAVE_UNISTD_H -DHAVE_SETMODE
|
---|
100 |
|
---|
101 | # If support ANSI C prototypes
|
---|
102 | DEFS_ansi_c = -DPROTOTYPES
|
---|
103 |
|
---|
104 | # No wchar support
|
---|
105 | # DEFS_wchar = -DUSE_WIDE_CHAR -DHAVE_WCHAR_H
|
---|
106 | # DEFS_wchar = -Dwchar_t=int -Dmbstate_t=int
|
---|
107 | DEFS_wchar = -DHAVE_WCHAR_H
|
---|
108 |
|
---|
109 | # Are strtol() and strtoul() declared?
|
---|
110 | #DEFS_strtol = -DHAVE_DECL_STRTOULL=0 -DHAVE_DECL_STRTOUL=0
|
---|
111 | DEFS_strtol = -DHAVE_DECL_STRTOULL=1 -DHAVE_DECL_STRTOUL=1
|
---|
112 |
|
---|
113 | # Define if malloc(0)/realloc(0) works
|
---|
114 | #DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=0 \
|
---|
115 | # -DHAVE_DONE_WORKING_REALLOC_CHECK=0
|
---|
116 | DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=1 \
|
---|
117 | -DHAVE_DONE_WORKING_REALLOC_CHECK=1
|
---|
118 |
|
---|
119 | DEFS = $(DEFS_core) $(DEFS_ansi_c) $(DEFS_wchar) $(DEFS_strtol) $(DEFS_alloc) \
|
---|
120 | -DHAVE_DECL_STRERROR_R=1 -DHAVE_VPRINTF -DCHAR_BIT=8 \
|
---|
121 | -DSTDOUT_FILENO=1
|
---|
122 |
|
---|
123 |
|
---|
124 | ####
|
---|
125 |
|
---|
126 | CFLAGS = $(DEFS) -I. -I.. -I$(libdir) \
|
---|
127 | -DVERSION=\"bootstrap\" -DPACKAGE=\"grep\" \
|
---|
128 | -DPACKAGE_STRING=\"grep\ bootstrap\" \
|
---|
129 | -DPACKAGE_BUGREPORT=\"bug-grep@gnu.org\"
|
---|
130 |
|
---|
131 | libdir = ../lib
|
---|
132 |
|
---|
133 | PROGS = grep$(EXEEXT) egrep$(EXEEXT) fgrep$(EXEEXT)
|
---|
134 |
|
---|
135 | libgreputils_a = $(libdir)/libgreputils.a
|
---|
136 |
|
---|
137 | all : $(libgreputils_a) $(PROGS)
|
---|
138 |
|
---|
139 | grep$(EXEEXT) : $(grep_OBJS) $(libgreputils_a)
|
---|
140 | $(CC) $(grep_OBJS) -o grep $(libgreputils_a)
|
---|
141 |
|
---|
142 | egrep$(EXEEXT) : $(egrep_OBJS) $(libgreputils_a)
|
---|
143 | $(CC) $(egrep_OBJS) -o egrep $(libgreputils_a)
|
---|
144 |
|
---|
145 | fgrep$(EXEEXT) : $(fgrep_OBJS) $(libgreputils_a)
|
---|
146 | $(CC) $(fgrep_OBJS) -o fgrep $(libgreputils_a)
|
---|
147 |
|
---|
148 | $(libgreputils_a) : $(LIB_OBJS)
|
---|
149 | $(AR) $(ARFLAGS) $(libgreputils_a) $(LIB_OBJS)
|
---|
150 |
|
---|
151 | clean :
|
---|
152 | $(RM) grep.$(OBJEXT) egrep.$(OBJEXT) fgrep.$(OBJEXT)
|
---|
153 | $(RM) search.$(OBJEXT) esearch.$(OBJEXT) fsearch.$(OBJEXT)
|
---|
154 | $(RM) kwset.$(OBJEXT) dfa.$(OBJEXT)
|
---|
155 | $(RM) $(PROGS)
|
---|
156 | $(RM) $(libgreputils_a) $(LIB_OBJS)
|
---|