summaryrefslogtreecommitdiff
path: root/bootstrap/Makefile.try
blob: 88f2caf2c325bbf2eb522e7d1dcdb5bfaf118820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#

# Define for DOS/WIN (not including DJGPP):
#OBJEXT = obj
#EXEEXT = .exe
EXEEXT =
OBJEXT = o

# Source of grep.
grep_OBJS = \
      grep.$(OBJEXT) \
      search.$(OBJEXT) \
      kwset.$(OBJEXT) \
      dfa.$(OBJEXT)
egrep_OBJS = \
      egrep.$(OBJEXT) \
      esearch.$(OBJEXT) \
      kwset.$(OBJEXT) \
      dfa.$(OBJEXT)
fgrep_OBJS = \
      fgrep.$(OBJEXT) \
      fsearch.$(OBJEXT) \
      kwset.$(OBJEXT)

# Supporting routines.
LIB_OBJS_core =  \
      $(libdir)/closeout.$(OBJEXT) \
      $(libdir)/error.$(OBJEXT) \
      $(libdir)/exclude.$(OBJEXT) \
      $(libdir)/hard-locale.$(OBJEXT) \
      $(libdir)/isdir.$(OBJEXT) \
      $(libdir)/quotearg.$(OBJEXT) \
      $(libdir)/regex.$(OBJEXT) \
      $(libdir)/savedir.$(OBJEXT) \
      $(libdir)/strtoumax.$(OBJEXT) \
      $(libdir)/xmalloc.$(OBJEXT) \
      $(libdir)/xstrtol.$(OBJEXT) \
      $(libdir)/xstrtoumax.$(OBJEXT)

# Comment out functions already supported as needed.
#LIB_OBJ_atexit   =  $(libdir)/atexit.$(OBJEXT)
#LIB_OBJ_alloca   =  $(libdir)/alloca.$(OBJEXT)
#LIB_OBJ_fnmatch  =  $(libdir)/fnmatch.$(OBJEXT)
LIB_OBJ_getopt   =  $(libdir)/getopt.$(OBJEXT) $(libdir)/getopt1.$(OBJEXT)
#LIB_OBJ_memchr   =  $(libdir)/memchr.$(OBJEXT)
LIB_OBJ_obstack  =  $(libdir)/obstack.$(OBJEXT)
#LIB_OBJ_strtoul  =  $(libdir)/strtoul.$(OBJEXT)
LIB_OBJ_stpcpy   =  $(libdir)/stpcpy.$(OBJEXT)
LIB_OBJ_strtoull = $(libdir)/strtoull.$(OBJEXT)

LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_atexit) $(LIB_OBJ_alloca) \
           $(LIB_OBJ_fnmatch) $(LIB_OBJ_getopt) $(LIB_OBJ_memchr) \
           $(LIB_OBJ_obstack) $(LIB_OBJ_strtoul) $(LIB_OBJ_stpcpy) \
           $(LIB_OBJ_strtoull)

# For Linux
#LIB_OBJS = $(LIB_OBJS_core)

# For QNX/Neutrino
#LIB_OBJS = $(LIB_OBJS_core) $(LIB_OBJ_getopt) $(LIB_OBJ_obstack) \
#            $(LIB_OBJ_stpcpy) $(LIB_OBJ_strtoull)

# Where is DIR and opendir/readdir defined.
#  or -DHAVE_DIRENT_H
#  or -DHAVE_SYS_NDIR_H
#  or -DHAVE_SYS_DIR_H
#  or -DHAVE_NDIR_H
#
# undef HAVE_STRERROR if lacking strerror()
# undef HAVE_MEMCHR if lacking memchr()
#

# default dry run
DEFS_core = \
           -DSTDC_HEADERS  \
           -DHAVE_MEMCHR \
           -DHAVE_DIRENT_H \
           -DHAVE_STRERROR \
           -Dconst= \
           -Dsize_t=unsigned \
           -Duintmax_t=long

# SunOS-4.1.x k&r cc
#DEFS_sunos =  -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -Dconst=

# Solaris
#DEFS_solaris = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_DIRENT_H -DHAVE_STRERROR

# DOS/WIN (change also OBJEXT/EXEEXT, see above)
# DOS/DJGPP
DEFS_dos = -DSTDC_HEADERS -DHAVE_MEMCHR -DHAVE_STRERROR -DHAVE_DIRENT_H \
           -DHAVE_DOS_FILE_CONTENTS \
           -DHAVE_DOS_FILE_NAMES -DHAVE_UNISTD_H -DHAVE_SETMODE

# If support ANSI C prototypes
DEFS_ansi_c = -DPROTOTYPES

# No wchar support
# DEFS_wchar = -DUSE_WIDE_CHAR -DHAVE_WCHAR_H
DEFS_wchar = -Dwchar_t=int -Dmbstate_t=int

# Is strtol() and strtoul()  declarared ?
#DEFS_strtol = -DHAVE_DECL_STRTOULL=0 -DHAVE_DECL_STRTOUL=0
DEFS_strtol = -DHAVE_DECL_STRTOULL=1 -DHAVE_DECL_STRTOUL=1

# Define if malloc(0)/realloc(0) works
#DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=0 \
#             -DHAVE_DONE_WORKING_REALLOC_CHECK=0
DEFS_alloc = -DHAVE_DONE_WORKING_MALLOC_CHECK=1 \
             -DHAVE_DONE_WORKING_REALLOC_CHECK=1

DEFS = $(DEFS_core) $(DEFS_ansi_c) $(DEFS_wchar) $(DEFS_strtol) $(DEFS_alloc) \
       -DHAVE_DECL_STRERROR_R=0 -DHAVE_VPRINTF -DCHAR_BIT=8


####

CFLAGS = $(DEFS) -I. -I.. -I$(libdir) -DVERSION=\"bootstrap\" -DPACKAGE=\"grep\"

libdir = ../lib

PROGS = grep$(EXEEXT) egrep$(EXEEXT) fgrep$(EXEEXT)

libgreputils_a = $(libdir)/libgreputils.a

all : $(libgreputils_a) $(PROGS)

grep$(EXEEXT)  :  $(grep_OBJS)          $(libgreputils_a)
	$(CC)     $(grep_OBJS) -o  grep $(libgreputils_a)

egrep$(EXEEXT) : $(egrep_OBJS)          $(libgreputils_a)
	$(CC)    $(egrep_OBJS) -o egrep $(libgreputils_a)

fgrep$(EXEEXT) : $(fgrep_OBJS)          $(libgreputils_a)
	$(CC)    $(fgrep_OBJS) -o fgrep $(libgreputils_a)

$(libgreputils_a) : $(LIB_OBJS)
	$(AR) $(ARFLAGS) $(libgreputils_a) $(LIB_OBJS)

clean :
	$(RM)   grep.$(OBJEXT)   egrep.$(OBJEXT)   fgrep.$(OBJEXT)
	$(RM) search.$(OBJEXT) esearch.$(OBJEXT) fsearch.$(OBJEXT)
	$(RM) kwset.$(OBJEXT) dfa.$(OBJEXT)
	$(RM) $(PROGS)
	$(RM) $(libgreputils_a) $(LIB_OBJS)