BIN_PATH = /home/httpd/cgi-bin/network/ddns_setting
SBIN_PATH = /usr/sbin
INITD_PATH = /etc/init.d

CC = ${CROSS_COMPILE}gcc
OBJFLAGS = -fPIC -Wall -c
APPCFLAGS = -s -O2
LIBS = -L${TARGET_PREFIX}/usr/lib -luLinux_Storage -luLinux_NAS -luLinux_cgi -luLinux_config -luLinux_PDC -luLinux_statistics -luLinux_quota -luLinux_Util -lpthread
INCLUDE = -I$(NAS_LIB_PATH)/hd -I$(NAS_LIB_PATH)/public_lib -I$(NAS_LIB_PATH)/NAS -I$(NAS_LIB_PATH)/config -I$(NAS_LIB_PATH)/include -I$(NAS_LIB_PATH)/uLinux -I$(NAS_LIB_PATH)/cgi -I$(NAS_LIB_PATH)/util -Iserver/lib

PROGS = ddns_setting.cgi 
CREATE_CONF_PROG = create_ddns_conf
OBJS = ddns_main.o
TESTOBJS = test.o

INSTALL_SHELL = ../install.sh
START_SHELL = ddns_update.sh
START_SHELL_FOR_CGI = ddns_update_for_cgi.sh

SEHLL = /bin/sh
SRCDIR = .

#DEBUG = -g -D_DEBUG

all:	$(PROGS)  $(CREATE_CONF_PROG)

%.o :			%.c %.h
			$(CC) $(DEBUG) -c $< $(INCLUDE)

test :			$(TESTOBJS)
			$(CC) $(LIBS) $(INCLUDE) $(TESTOBJS) -o test

$(PROGS) :		$(OBJS)
			$(CC) $(DEBUG) $(APPCFLAGS) $(INCLUDE) $(OBJS) $(LIBS) -o $@
			
$(CREATE_CONF_PROG):	
			$(CC) $(DEBUG) $(APPCFLAGS) $(INCLUDE)  create_ddns_conf.c $(LIBS) -o $@

install :
#	@ echo 'install file ...'
#	@ $(SHELL) $(SRCDIR)/$(INSTALL_SHELL) $(ROOT_PATH)$(BIN_PATH) $(ROOT_PATH)$(BIN_PATH)/html $(ROOT_PATH)$(BIN_PATH)/inc
#	install --mode=755 $(PROGS) $(ROOT_PATH)$(BIN_PATH)
#	install --mode=755 $(CREATE_CONF_PROG) $(ROOT_PATH)$(SBIN_PATH)
#	install --mode=755 $(START_SHELL) $(ROOT_PATH)$(INITD_PATH)
#	install --mode=755 $(START_SHELL_FOR_CGI) $(ROOT_PATH)$(INITD_PATH)
#	install --mode=644 html/*.html $(ROOT_PATH)$(BIN_PATH)/html
#	install --mode=644 inc/*.js $(ROOT_PATH)$(BIN_PATH)/inc
##	install --mode=644 inc-CODEPAGE/*.js $(ROOT_PATH)$(BIN_PATH)/inc-CODEPAGE
##	/bin/ln -sf $(BIN_PATH)/inc-CODEPAGE $(ROOT_PATH)$(BIN_PATH)/inc

clean :
	@ echo 'clear file ...'
	@ rm $(PROGS) $(CREATE_CONF_PROG) test *.o -f

clean_test:
	@ echo 'clear test file...'
	@ rm test test.o -f
