############################################################################
# Makefile for the ALMOS-MKH  "idbg"  application
############################################################################

-include ../../params-soft.mk

ifeq ($(ARCH_NAME),)
$(error Please define in ARCH_NAME parameter in params-soft.mk!)
endif

OBJS = build/idbg.o

INCLUDES = -I. -I$(LIBC_INCLUDE) -I$(LIBALMOSMKH_INCLUDE) -I$(SHARED_INCLUDE) -I$(LIBPTHREAD_INCLUDE)

compile: dirs build/idbg.elf

build/idbg.elf : $(OBJS) idbg.ld
	$(LD) -o $@ -T idbg.ld $(OBJS) -nostdlib -L$(LIBC) -L$(LIBPTHREAD) -L$(LIBALMOSMKH)  -lpthread -lc -lalmos-mkh -lc -lpthread -lc -lalmos-mkh -lpthread -lc
	$(DU) -D $@ > $@.txt

build/idbg.o : idbg.c
	$(CC) $(INCLUDES) -L$(LIBC) $(CFLAGS) -c -o  $@ $<

dirs:
	@mkdir -p build/

clean:
	rm -rf build/*.o  build/*.elf  build/*.txt

.PHONY: dirs clean


