ifndef COMPILING_WHOLE_TREE
TOPDIR=$(shell pwd)/../../..
endif

include $(TOPDIR)/Rules.make


PREFIX?=/usr/local
BINDIR = ${PREFIX}/sbin
MANDIR = ${PREFIX}/man

SRC = src

CFLAGS?= -O2 

CFLAGS+= -Werror

ifdef CONFIG_SUPPORT_IBIS
CFLAGS+= -DDNS_BIS
endif

conf_file-y:=dnsmasq.conf  #default
conf-file-$(CONFIG_NETWORK_IPDECT):=dnsmasq.conf.ipdect
#conf-file-$(CONFIG_B3G):=dnsmasq.conf.b3g


conf-file-$(CONFIG_FUSION1A_UMA_BT):=dnsmasq.conf.


launch_file-y:=dhcp_dns_server   #default
launch_file-$(CONFIG_NETWORK_IPDECT):=dhcp_dns_server.ipdect
launch_file-$(CONFIG_FUSION1A_UMA_BT):=dhcp_dns_server.fusion


all : 
	$(MAKE) -f ../bld/Makefile -C $(SRC) dnsmasq 

clean :
	rm -f *~ bld/*~ contrib/*/*~ */*~ $(SRC)/*.o $(SRC)/dnsmasq core build

install : all
	install -d $(DESTDIR)$(BINDIR) -d $(DESTDIR)$(MANDIR)/man8
	install -m 644 dnsmasq.8 $(DESTDIR)$(MANDIR)/man8 
	install -m 755 $(SRC)/dnsmasq $(DESTDIR)$(BINDIR)


release : 
	install -m 755 $(SRC)/dnsmasq $(ROOT_FS_DIR)/usr/bin 
	install -m 644 ${conf_file-y} $(ROOT_FS_DIR)/etc_ro_fs/dnsmasq.conf
	install -m 755 ${launch_file-y} $(ROOT_FS_DIR)/etc_ro_fs/init.d/dhcp_dns_server




