FBC=fbc

platform:=$(shell $(FBC) -version)

INC=$(wildcard source/*.bi)
SRC=$(wildcard source/*.bas)
OBJ=$(patsubst source/%.bas,o/%.o,$(SRC))

FBFLAGS=-g -exx
EXENAME=ddd
MAINBAS=ddd

ifeq "" "$(findstring :linux,$(platform))"
EXENAME := $(EXENAME).exe
endif

all: $(EXENAME)

$(EXENAME): $(OBJ)
	$(FBC) $(FBFLAGS) $(OBJ) -x $(EXENAME)

o/%.o: source/%.bas $(INC)
	$(FBC) $(FBFLAGS) -m $(MAINBAS) -c $< -o $@

clean:
	$(RM) -f $(OBJ)
