-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile.linux
185 lines (141 loc) · 8.69 KB
/
Makefile.linux
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Copyright (c) 1994 Sun Wu, Udi Manber, Burra Gopal. All Rights Reserved.
# To compile for structured queries, make "all: Sall" and "STRUCTURED_QUERIES=1".
#STRUCTURED_QUERIES = 0
STRUCTURED_QUERIES = 1
#all: NOTSall
all: Sall
# Define HAVE_DIRENT_H to be 1 when you don't have <sys/dir.h> else define it to be 0 (in this case, one of the other 3 flags may need to be defined to be 1).
HAVE_DIRENT_H = 1
HAVE_SYS_DIR_H = 0
HAVE_SYS_NDIR_H = 0
HAVE_NDIR_H = 0
HAVE_STRERROR = 1
# Define UTIME to be 1 if you have the utime() routine on your system. Else define it to be 0.
UTIME = 1
# Define ISO_CHAR_SET to be 1 if you want to use the international 8bit character set. Else define it to be 0.
ISO_CHAR_SET = 1
# You might have to change this depending on your machine configuration.
CC = gcc -mpentiumpro
SHELL = /bin/sh
# For compatibility with SFS, define this flag (internal only)
SFS_COMPAT = 0
# YOU DON'T HAVE TO CHANGE ANYTHING BELOW THIS LINE
# The binaries will be made in ./bin/. and the libraries are assumed to
# be in ./lib . You normally don't have to change them.
# NOTE: GLIMPSEDIR can be relative or absolute.
GLIMPSEDIR = ..
BINDIR = bin
AGREPDIR = agrep
INDEXDIR = index
COMPRESSDIR = compress
TEMPLATEDIR = libtemplate
LIBDIR = lib
LIBTEMPLATEDIR = $(TEMPLATEDIR)/lib
DYNFILTERDIR = dynfilters
LIBAGREP = agrep
LIBCOMPRESS = cast
LIBTEMPLATE = template
LIBUTIL = util
OTHERLIBS = -ldl
PROG = glimpse
PROGSERVER = glimpseserver
NOTSPROG = nots$(PROG)
NOTSPROGSERVER = nots$(PROGSERVER)
PROGINDEX = index/glimpseindex
PROGAGREP = agrep/agrep
DYNHTMLFILTER = dynfilters/htuml2txt.so
# Include flags is not a part of CLFAGS and LINKFLAGS since path names from subdirs can be different
OPTIMIZEFLAGS = -O2
#PROFILEFLAGS = -p
#DEBUGFLAGS = -g -DBG_DEBUG=1 -DDEBUG=1
INCLUDEFLAGS = -I$(INDEXDIR) -I$(AGREPDIR) -I$(TEMPLATEDIR)/include
DEFINEFLAGS = -DSTRUCTURED_QUERIES=$(STRUCTURED_QUERIES) -DHAVE_DIRENT_H=$(HAVE_DIRENT_H) -DHAVE_SYS_DIR_H=$(HAVE_SYS_DIR_H) -DHAVE_STRERROR=$(HAVE_STRERROR)\
-DHAVE_SYS_NDIR_H=$(HAVE_SYS_NDIR_H) -DHAVE_NDIR_H=$(HAVE_NDIR_H) -DUTIME=$(UTIME) -DISO_CHAR_SET=$(ISO_CHAR_SET) -DSFS_COMPAT=$(SFS_COMPAT)
SUBDIRCFLAGS = -c $(DEFINEFLAGS) $(OPTIMIZEFLAGS) $(PROFILEFLAGS) $(DEBUGFLAGS)
CFLAGS = $(INCLUDEFLAGS) $(SUBDIRCFLAGS)
SUBDIRLINKFLAGS = $(PROFILEFLAGS)
LINKFLAGS = $(INCLUDES) $(SUBDIRLINKFLAGS)
OBJS = get_filename.o \
get_index.o \
split.o \
$(INDEXDIR)/region.o \
$(INDEXDIR)/getword.o \
$(INDEXDIR)/filetype.o \
$(INDEXDIR)/simpletest.o \
$(INDEXDIR)/memlook.o \
$(INDEXDIR)/lib.o\
$(INDEXDIR)/io.o
HDRS = $(INDEXDIR)/glimpse.h $(AGREPDIR)/agrep.h $(AGREPDIR)/checkfile.h $(AGREPDIR)/re.h $(INDEXDIR)/region.h
SRC = main.c \
get_filename.c \
get_index.c \
split.c \
$(INDEXDIR)/region.c \
$(INDEXDIR)/getword.c \
$(INDEXDIR)/filetype.c \
$(INDEXDIR)/simpletest.c \
$(INDEXDIR)/memlook.c \
$(INDEXDIR)/io.c
Sall: $(PROGINDEX) $(PROGAGREP) $(PROG) $(PROGSERVER) $(DYNHTMLFILTER)
NOTSall: $(PROGINDEX) $(PROGAGREP) $(NOTSPROG) $(NOTSPROGSERVER)
$(PROGINDEX): $(PROGAGREP) $(LIBDIR)/lib$(LIBAGREP).a $(LIBTEMPLATEDIR)/lib$(LIBTEMPLATE).a $(LIBTEMPLATEDIR)/lib$(LIBUTIL).a $(LIBDIR)/lib$(LIBCOMPRESS).a
cd $(INDEXDIR) ; $(MAKE) -f Makefile.linux CC="$(CC)" SUBDIRCFLAGS="$(SUBDIRCFLAGS)" SUBDIRLINKFLAGS="$(SUBDIRLINKFLAGS)" SHELL="$(SHELL)" HAVE_DIRENT_H="$(HAVE_DIRENT_H)" HAVE_SYS_DIR_H="$(HAVE_SYS_DIR_H)" HAVE_SYS_NDIR_H="$(HAVE_SYS_NDIR_H)" HAVE_NDIR_H="$(HAVE_NDIR_H)" UTIME="$(UTIME)" STRUCTURED_QUERIES="$(STRUCTURED_QUERIES)" ISO_CHAR_SET="$(ISO_CHAR_SET)" SFS_COMPAT="$(SFS_COMPAT)"
$(PROGAGREP): $(LIBDIR)/lib$(LIBCOMPRESS).a
cd $(AGREPDIR) ; $(MAKE) -f Makefile.linux CC="$(CC)" SUBDIRCFLAGS="$(SUBDIRCFLAGS)" SUBDIRLINKFLAGS="$(SUBDIRLINKFLAGS)" SHELL="$(SHELL)" HAVE_DIRENT_H="$(HAVE_DIRENT_H)" HAVE_SYS_DIR_H="$(HAVE_SYS_DIR_H)" HAVE_SYS_NDIR_H="$(HAVE_SYS_NDIR_H)" HAVE_NDIR_H="$(HAVE_NDIR_H)" UTIME="$(UTIME)" STRUCTURED_QUERIES="$(STRUCTURED_QUERIES)" ISO_CHAR_SET="$(ISO_CHAR_SET)" SFS_COMPAT="$(SFS_COMPAT)"
$(LIBDIR)/lib$(LIBCOMPRESS).a: $(HDRS)
cd $(COMPRESSDIR); $(MAKE) -f Makefile.linux CC="$(CC)" SUBDIRCFLAGS="$(SUBDIRCFLAGS)" SUBDIRLINKFLAGS="$(SUBDIRLINKFLAGS)" SHELL="$(SHELL)" HAVE_DIRENT_H="$(HAVE_DIRENT_H)" HAVE_SYS_DIR_H="$(HAVE_SYS_DIR_H)" HAVE_SYS_NDIR_H="$(HAVE_SYS_NDIR_H)" HAVE_NDIR_H="$(HAVE_NDIR_H)" UTIME="$(UTIME)" STRUCTURED_QUERIES="$(STRUCTURED_QUERIES)" ISO_CHAR_SET="$(ISO_CHAR_SET)" SFS_COMPAT="$(SFS_COMPAT)"
$(PROG): main.o $(OBJS) $(SRC) $(HDRS) $(LIBDIR)/lib$(LIBAGREP).a $(LIBTEMPLATEDIR)/lib$(LIBTEMPLATE).a $(LIBTEMPLATEDIR)/lib$(LIBUTIL).a $(LIBDIR)/lib$(LIBCOMPRESS).a
$(CC) $(LINKFLAGS) -L$(LIBDIR) -L$(LIBTEMPLATEDIR) -o $(PROG) main.o $(OBJS) -l$(LIBAGREP) -l$(LIBTEMPLATE) -l$(LIBUTIL) $(OTHERLIBS)
cp $(PROG) $(BINDIR)
$(NOTSPROG): main.o $(OBJS) $(SRC) $(HDRS) $(LIBDIR)/lib$(LIBAGREP).a $(LIBDIR)/lib$(LIBCOMPRESS).a
$(CC) $(LINKFLAGS) -L$(LIBDIR) -o $(PROG) main.o $(OBJS) -l$(LIBAGREP) $(OTHERLIBS)
cp $(PROG) $(BINDIR)
$(PROGSERVER): main_server.o $(OBJS) $(SRC) $(HDRS) $(LIBDIR)/lib$(LIBAGREP).a $(LIBTEMPLATEDIR)/lib$(LIBTEMPLATE).a $(LIBTEMPLATEDIR)/lib$(LIBUTIL).a $(LIBDIR)/lib$(LIBCOMPRESS).a
$(CC) $(LINKFLAGS) -L$(LIBDIR) -L$(LIBTEMPLATEDIR) -o $(PROGSERVER) main_server.o $(OBJS) -l$(LIBAGREP) -l$(LIBTEMPLATE) -l$(LIBUTIL) $(OTHERLIBS)
cp $(PROGSERVER) $(BINDIR)
$(NOTSPROGSERVER): main_server.o $(OBJS) $(SRC) $(HDRS) $(LIBDIR)/lib$(LIBAGREP).a $(LIBDIR)/lib$(LIBCOMPRESS).a
$(CC) $(LINKFLAGS) -L$(LIBDIR) -o $(PROGSERVER) main_server.o $(OBJS) -l$(LIBAGREP) $(OTHERLIBS)
cp $(PROGSERVER) $(BINDIR)
$(LIBTEMPLATEDIR)/lib$(LIBTEMPLATE).a:
cd $(TEMPLATEDIR) ; $(MAKE) -f Makefile.linux CC="$(CC)" SUBDIRCFLAGS="$(SUBDIRCFLAGS)" SUBDIRLINKFLAGS="$(SUBDIRLINKFLAGS)" SHELL="$(SHELL)" HAVE_STRERROR="$(HAVE_STRERROR)" HAVE_DIRENT_H="$(HAVE_DIRENT_H)" HAVE_SYS_DIR_H="$(HAVE_SYS_DIR_H)" HAVE_SYS_NDIR_H="$(HAVE_SYS_NDIR_H)" HAVE_NDIR_H="$(HAVE_NDIR_H)" UTIME="$(UTIME)" STRUCTURED_QUERIES="$(STRUCTURED_QUERIES)" ISO_CHAR_SET="$(ISO_CHAR_SET)" SFS_COMPAT="$(SFS_COMPAT)"
$(LIBTEMPLATEDIR)/lib$(LIBUTIL).a:
cd $(TEMPLATEDIR) ; $(MAKE) -f Makefile.linux CC="$(CC)" SUBDIRCFLAGS="$(SUBDIRCFLAGS)" SUBDIRLINKFLAGS="$(SUBDIRLINKFLAGS)" SHELL="$(SHELL)" HAVE_DIRENT_H="$(HAVE_DIRENT_H)" HAVE_SYS_DIR_H="$(HAVE_SYS_DIR_H)" HAVE_SYS_NDIR_H="$(HAVE_SYS_NDIR_H)" HAVE_NDIR_H="$(HAVE_NDIR_H)" UTIME="$(UTIME)" STRUCTURED_QUERIES="$(STRUCTURED_QUERIES)" ISO_CHAR_SET="$(ISO_CHAR_SET)" SFS_COMPAT="$(SFS_COMPAT)"
$(LIBDIR)/lib$(LIBAGREP).a:
cd $(AGREPDIR); $(MAKE) -f Makefile.linux CC="$(CC)" SUBDIRCFLAGS="$(SUBDIRCFLAGS)" SUBDIRLINKFLAGS="$(SUBDIRLINKFLAGS)" SHELL="$(SHELL)" HAVE_DIRENT_H="$(HAVE_DIRENT_H)" HAVE_SYS_DIR_H="$(HAVE_SYS_DIR_H)" HAVE_SYS_NDIR_H="$(HAVE_SYS_NDIR_H)" HAVE_NDIR_H="$(HAVE_NDIR_H)" UTIME="$(UTIME)" STRUCTURED_QUERIES="$(STRUCTURED_QUERIES)" ISO_CHAR_SET="$(ISO_CHAR_SET)" SFS_COMPAT="$(SFS_COMPAT)"
$(DYNHTMLFILTER): $(DYNFILTERDIR)/htuml2txt.lex
cd $(DYNFILTERDIR); $(MAKE) -f Makefile.linux htuml2txt.so
# Check target
check: all
$(SHELL) test/check.sh
clean:
-rm -f main_server.o main_server.c main.o $(OBJS) core a.out $(LIBDIR)/lib$(LIBAGREP).a $(PROG) $(PROGSERVER)
cd $(AGREPDIR); $(MAKE) clean
cd $(INDEXDIR) ; $(MAKE) clean
cd $(COMPRESSDIR); $(MAKE) clean
cd $(TEMPLATEDIR); $(MAKE) clean
cd $(DYNFILTERDIR); $(MAKE) -f Makefile.linux clean
main_server.o: main.c defs.h $(AGREPDIR)/agrep.h $(AGREPDIR)/checkfile.h $(INDEXDIR)/glimpse.h
cp main.c main_server.c
$(CC) $(CFLAGS) -DISSERVER=1 -o $@ main_server.c
main.o: main.c defs.h $(AGREPDIR)/agrep.h $(AGREPDIR)/checkfile.h $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -DISSERVER=0 -o $@ main.c
get_filename.o: get_filename.c $(AGREPDIR)/agrep.h $(AGREPDIR)/checkfile.h $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ get_filename.c
get_index.o: get_index.c $(AGREPDIR)/agrep.h $(AGREPDIR)/checkfile.h $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ get_index.c
split.o: split.c $(AGREPDIR)/agrep.h $(AGREPDIR)/checkfile.h $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ split.c
$(INDEXDIR)/lib.o: $(INDEXDIR)/lib.c $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/lib.c
$(INDEXDIR)/io.o: $(INDEXDIR)/io.c $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/io.c
$(INDEXDIR)/region.o: $(INDEXDIR)/region.c $(INDEXDIR)/glimpse.h $(INDEXDIR)/region.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/region.c
$(INDEXDIR)/getword.o: $(INDEXDIR)/getword.c $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/getword.c
$(INDEXDIR)/filetype.o: $(INDEXDIR)/filetype.c $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/filetype.c
$(INDEXDIR)/simpletest.o: $(INDEXDIR)/simpletest.c $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/simpletest.c
$(INDEXDIR)/memlook.o: $(INDEXDIR)/memlook.c $(INDEXDIR)/glimpse.h
$(CC) $(CFLAGS) -o $@ $(INDEXDIR)/memlook.c