

# Target file name.
TARGET = out


# List C source files here.
SRC = 	main.c \
		file1.c \
		file2.c


# Compiler flags.
FLAGS = --use-stdout
FLAGS += --model-large
#FLAGS += --xram-size 2048
#FLAGS += --stack-size 128

# Define all object files.
OBJ = $(SRC:.c=.rel)


# Default target.
all: begin build end

build: $(OBJ)
	@echo
	@echo Linking $(OBJ)
	sdcc $(FLAGS) $(OBJ) -o $(TARGET).hex

begin:
	@echo
	@echo -------- begin --------

end:
	@echo
	@echo --------  end  --------

$(OBJ):
	@echo
	@echo Compiling $(@:.rel=.c)
	sdcc $(FLAGS) -c $(@:.rel=.c)

# Listing of phony targets.
.PHONY : all begin end build
