
ifndef TOPDIR
	TOPDIR = $(shell cd ..;pwd)
	include $(TOPDIR)/../comp_standalone
endif


OBJS =	read_sysinfo.o net_reset_ppp_gateway.o net_gateway.o net_dhcpc.o query_netdevice.o monitor_control.o 

ifeq ($(_HAVE_MMU), 1)
OUTPUT = libamitopen.so
else
OUTPUT = libamitopen.a

endif


CFLAGS += -D__unix__ -DCHAR_BIT=8 
CFLAGS +=  -Wall #-DDEBUG_TRACE

CFLAGS += -I$(TOPDIR)/amit_open_include 
ifeq ($(_HAVE_MMU), 1)
	CFLAGS += -shared -fPIC
	LIBS   += -lcrypt	
endif

all: $(OUTPUT) 


ifeq ($(_HAVE_MMU), 1)
$(OUTPUT): $(OBJS)
	${CC} $(CFLAGS) -o $(OUTPUT) $(LIBS) $(OBJS)
else
$(OUTPUT): $(OBJS)
	${AR} crv $(OUTPUT) $(LIBS) $(OBJS)
endif

clean:
	rm -f *.[oa] *.so *.elf *~ core test_flash *.gdb install.ok 
				#../../rom_disk/bak.lib/libamit*

ifeq ($(_HAVE_MMU), 1)
install: all
	touch install.ok
	$(STRIP) $(OUTPUT)
	$(CP)    $(OUTPUT) ../../rom_disk/bak.lib/
else
install: all
	touch install.ok
endif

GPL:
	@echo Do Nothing about GPL.

#################
#   dependence
#################
$(OUTPUT):	${OBJS}

