# $Id: Makefile,v 1.2 2006/09/16 12:17:17 maxim Exp $
#
#

include ../Rules.make

BIN     = 0W-httpd convert-ranges convert-geoip
OBJS	= httpd.o config.o core.o handlers.o filters.o proxy.o flood.o access.o files.o buffer.o listing.o cache.o
HEADERS = httpd.h config.h core.h handlers.h filters.h proxy.h flood.h access.h files.h buffer.h listing.h cache.h ../configure.h

all: $(BIN)

$(OBJS): $(HEADERS) Makefile ../Rules.make

built.o: $(OBJS) $(COMMON)

0W-httpd: $(OBJS) $(COMMON) built.o
	$(CC) $(LDFLAGS) $(OBJS) $(COMMON) built.o -o $@

convert-ranges: $(COMMON) Makefile ../Rules.make convert-ranges.c
	$(CC) $(CFLAGS) $(LDFLAGS) $@.c $(COMMON) -o $@
	chmod +s $@

convert-geoip: $(COMMON) Makefile ../Rules.make convert-geoip.c
	$(CC) $(CFLAGS) $(LDFLAGS) $@.c $(COMMON) -o $@
	chmod +s $@

$(COMMON):
	cd ../common &&$(MAKE)

install: 0W-httpd
	mv ../../bin/0W-httpd ../../bin/0W-httpd~
	cp 0W-httpd ../../bin/0W-httpd
	chmod +s ../../bin/0W-httpd

clean:
	rm -f $(BIN) *.o *~

