# 
# configurable options
#  - set DEBUG = 1 to turn on debugging support
#
DEBUG = 0
PROJ_NAME = disk_emu
INSTALL_DIR = 
PROGS := $(PROJ_NAME)
CFLAGS += -O2
CROSS := nios2-linux-uclibc-
CC    := $(CROSS)gcc

FLTFLAGS := -s 8192
#FLTFLAGS :=

#
# You should not need to modify anything beyond this point
#

OBJS = disk_emu.o

#CFLAGS += -D__linux__
CFLAGS += -fno-optimize-sibling-calls

all: $(PROGS)

$(PROJ_NAME): $(OBJS)
	$(CC) -elf2flt="$(FLTFLAGS)" -o $@ $^ $(LDLIBS)
#    -cp $(PROJ_NAME) ~/uClinux-dist/romfs/opt/

.PHONY: clean
clean:
	-rm -f *.[oad] *.elf *.gdb $(PROJ_NAME)

.PHONY: install
install: all
ifeq "$(INSTALL_DIR)" ""
	$(error No installation directory specified)
endif
	mkdir -p $(INSTALL_DIR)/bin
	install -v $(filter %.exe, $(PROGS)) $(INSTALL_DIR)/bin

