# $Id: Makefile,v 1.2 2008/05/19 11:39:41 kathy Exp $

.SUFFIXES:
.SUFFIXES: .o .c
.PHONY: clean mrclean distclean all dist depend

# The following gcc warning switches are too noisy to be useful checking
# Boa for lint:
#  -Wtraditional -Wconversion -Wredundant-decls -Wunreachable-code -W
# The following gcc warning switches should generate no warnings:
GCC_FLAGS = -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual \
  -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs \
  -Wall -Winline -Wwrite-strings -Wundef -pedantic


ifeq ($(INSTALL_DIR),)
INSTALL_DIR=$(PWD)/../../../
endif


srcdir = .
VPATH = ./../extras
LDFLAGS =  -g
LIBS =  -lcrypt -L$(INSTALL_DIR)/WebUI/nvram -lnvram
CFLAGS = -g -O2 -pipe -Wall -DPHY_N_SUPPORT  -DUSE_DEBUG
CFLAGS += -DCONFIG_STA_SUPPORT
CFLAGS += -DQOS_DLS_SUPPORT
CFLAGS += -DDOT11_N_SUPPORT
CPPFLAGS = -I.  -I$(INSTALL_DIR)/RT2870/include
DEPEND = .depend

CC = gcc 
CPP = gcc -E
#CC = i386-linux-gcc 
#CPP = i386-linux-gcc -E

SOURCES = auth.c alias.c boa.c buffer.c cgi.c cgi_header.c config.c escape.c \
	get.c hash.c ip.c log.c methods.c mmap_cache.c pipe.c queue.c range.c \
	read.c request.c response.c signals.c scripts.c util.c sublog.c \
	select.c 

OBJS = $(SOURCES:.c=.o) timestamp.o 

all:	boa boa_indexer

boa:	$(OBJS) 
	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)
	
boa_indexer:	index_dir.o escape.o   
	$(CC) -o $@ $^ $(LDFLAGS) $(LIBS)

clean:
	rm -f $(OBJS) boa core *~ boa_indexer index_dir.o
	rm -f    poll.o select.o access.o
	
distclean:	mrclean

mrclean:	clean
	rm -f config.status config.cache config.h Makefile config.log

# timestamp

timestamp.o:	$(SOURCES)

# depend stuff
depend: $(SOURCES)
	$(CPP) $(CPPFLAGS) -MM $^ select.c poll.c access.c > $(DEPEND)
        
-include $(DEPEND)


# tags
tags:	$(SOURCES)
	ctags -o tags $^ *.h

# object dump
boa.objdump:    boa
	objdump --disassemble-all --source boa > $@

