# RetroForth 6.20                                        http://retro.tunes.org
# -----------------------------------------------------------------------------
# Top level Makefile
# To use: make 'name of port'


# Global Settings
# -----------------------------------------------------------------------------
FILES = 
SOURCEDIR = ports-nasm
ASM = nasm
ASM_ARGS = -felf -g
ASM_PREFIX = -o
TARGET=linux-console linux-svga linux-sdl native
CC = gcc
# -----------------------------------------------------------------------------
# For FASM use:
# SOURCEDIR = ports-fasm
# ASM = fasm
# TARGET = linux-console windows-console

all: $(TARGET)

linux-console: $(SOURCEDIR)/linux-console/retro.asm
	echo -e RetroForth 6.20 :: linux-console
	cd $(SOURCEDIR)/linux-console && $(ASM) retro.asm $(ASM_PREFIX)retro.o $(ASM_ARGS)
	cd $(SOURCEDIR)/linux-console && ld retro.o -orf
	cd $(SOURCEDIR)/linux-console && chmod +x rf
linux-svga: $(SOURCEDIR)/linux-svga/retro.asm
	echo -e RetroForth 6.20 :: linux-svga
	cd $(SOURCEDIR)/linux-svga && $(ASM) retro.asm $(ASM_PREFIX)retro.o $(ASM_ARGS)
	cd $(SOURCEDIR)/linux-svga && gcc retro.o -orf -lvga
	cd $(SOURCEDIR)/linux-svga && chmod u+s rf
linux-sdl: $(SOURCEDIR)/linux-sdl/retro.asm
	echo -e RetroForth 6.20 :: linux-sdl
	cd $(SOURCEDIR)/linux-sdl && $(ASM) retro.asm $(ASM_PREFIX)retro.o $(ASM_ARGS)
	cd $(SOURCEDIR)/linux-sdl && gcc retro.o -orf /usr/lib/libSDL-1.2.so.0
	cd $(SOURCEDIR)/linux-sdl && chmod u+s rf
windows-console: $(SOURCEDIR)/windows-console/retro.asm
	cd $(SOURCEDIR)/windows-console && $(ASM) retro.asm rf.exe $(ASM_ARGS)

clean: *
	./clean

