
CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
LIBS=$(EXTRA_LIBS) $(LIBS1)
INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)

LIB=  libmain.a
HEADERS= test_char.h uri_delims.h 

OBJS= alloc.o buff.o \
      http_config.o http_core.o http_log.o \
      http_main.o http_protocol.o http_request.o http_vhost.o \
      util.o util_date.o util_script.o util_uri.o util_md5.o \
      rfc1413.o

.c.o:
	$(CC) -c $(INCLUDES) $(CFLAGS) $<

all: $(HEADERS) $(LIB)

$(LIB): $(OBJS)
	rm -f $@
	ar cr $@ $(OBJS)
	$(RANLIB) $@

clean:
	rm -f *.o $(LIB) uri_delims.h gen_uri_delims test_char.h gen_test_char

distclean: clean
	-rm -f Makefile

uri_delims.h: gen_uri_delims
	./gen_uri_delims >uri_delims.h

gen_uri_delims: gen_uri_delims.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o gen_uri_delims gen_uri_delims.o $(LIBS)

test_char.h: gen_test_char
	./gen_test_char >test_char.h

gen_test_char: gen_test_char.o
	$(CC) $(CFLAGS) $(LDFLAGS) -o gen_test_char gen_test_char.o $(LIBS)

# We really don't expect end users to use this rule.  It works only with
# gcc, and rebuilds Makefile.tmpl.  You have to re-run Configure after
# using it.
depend:
	cp Makefile.tmpl Makefile.tmpl.bak \
	    && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
	    && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
	    && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
	           -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
		> Makefile.tmpl \
	    && rm Makefile.new

#Dependencies

$(OBJS): Makefile

# DO NOT REMOVE
alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/multithread.h $(INCDIR)/http_log.h
buff.o: buff.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_main.h $(INCDIR)/http_log.h
gen_test_char.o: gen_test_char.c $(INCDIR)/httpd.h \
 $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
 $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \
 $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \
 $(INCDIR)/ap.h $(INCDIR)/util_uri.h
gen_uri_delims.o: gen_uri_delims.c
http_config.o: http_config.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_config.h $(INCDIR)/http_core.h $(INCDIR)/http_log.h \
 $(INCDIR)/http_request.h $(INCDIR)/http_conf_globals.h \
 $(INCDIR)/http_vhost.h $(INCDIR)/explain.h
http_core.o: http_core.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_config.h $(INCDIR)/http_core.h \
 $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
 $(INCDIR)/http_conf_globals.h $(INCDIR)/http_vhost.h \
 $(INCDIR)/http_main.h $(INCDIR)/http_log.h $(INCDIR)/rfc1413.h \
 $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h $(INCDIR)/scoreboard.h \
 $(INCDIR)/fnmatch.h
http_log.o: http_log.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_config.h $(INCDIR)/http_core.h $(INCDIR)/http_log.h \
 $(INCDIR)/http_main.h
http_main.o: http_main.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_main.h $(INCDIR)/http_log.h $(INCDIR)/http_config.h \
 $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
 $(INCDIR)/http_conf_globals.h $(INCDIR)/http_core.h \
 $(INCDIR)/http_vhost.h $(INCDIR)/util_script.h \
 $(INCDIR)/scoreboard.h $(INCDIR)/multithread.h $(INCDIR)/explain.h
http_protocol.o: http_protocol.c $(INCDIR)/httpd.h \
 $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
 $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \
 $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \
 $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \
 $(INCDIR)/http_core.h $(INCDIR)/http_protocol.h \
 $(INCDIR)/http_main.h $(INCDIR)/http_request.h \
 $(INCDIR)/http_vhost.h $(INCDIR)/http_log.h $(INCDIR)/util_date.h \
 $(INCDIR)/http_conf_globals.h
http_request.o: http_request.c $(INCDIR)/httpd.h \
 $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
 $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \
 $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h $(INCDIR)/buff.h \
 $(INCDIR)/ap.h $(INCDIR)/util_uri.h $(INCDIR)/http_config.h \
 $(INCDIR)/http_request.h $(INCDIR)/http_core.h \
 $(INCDIR)/http_protocol.h $(INCDIR)/http_conf_globals.h \
 $(INCDIR)/http_log.h $(INCDIR)/http_main.h $(INCDIR)/scoreboard.h \
 $(INCDIR)/fnmatch.h
http_vhost.o: http_vhost.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \
 $(INCDIR)/http_log.h $(INCDIR)/http_vhost.h \
 $(INCDIR)/http_protocol.h
rfc1413.o: rfc1413.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_log.h $(INCDIR)/rfc1413.h $(INCDIR)/http_main.h
util.o: util.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_conf_globals.h $(INCDIR)/http_log.h test_char.h
util_date.o: util_date.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
 $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h $(INCDIR)/ap_ctype.h \
 $(INCDIR)/hsregex.h $(INCDIR)/util_date.h
util_md5.o: util_md5.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/util_md5.h $(INCDIR)/ap_md5.h
util_script.o: util_script.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_config.h $(INCDIR)/http_conf_globals.h \
 $(INCDIR)/http_main.h $(INCDIR)/http_log.h \
 $(INCDIR)/http_protocol.h $(INCDIR)/http_core.h \
 $(INCDIR)/http_request.h $(INCDIR)/util_script.h \
 $(INCDIR)/util_date.h
util_uri.o: util_uri.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \
 $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
 $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap_alloc.h \
 $(INCDIR)/buff.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
 $(INCDIR)/http_log.h $(INCDIR)/http_conf_globals.h uri_delims.h
