# Step 06 -- Build the COFF loader with relocation processing + test BOF
#
# This step makes the loader FUNCTIONAL: it can load and execute BOFs.
#
# Usage:
#   make                -- build the loader and the test BOF
#   make run            -- build and run: COFFLoader.exe go hello_bof.o
#   make clean          -- remove compiled files

CC_MINGW = x86_64-w64-mingw32-gcc
CFLAGS   = -c

all: COFFLoader.exe hello_bof.o

COFFLoader.exe: COFFLoader.c beacon_compatibility.c COFFLoader.h beacon_compatibility.h
	$(CC_MINGW) COFFLoader.c beacon_compatibility.c -o COFFLoader.exe

hello_bof.o: hello_bof.c beacon.h
	$(CC_MINGW) $(CFLAGS) hello_bof.c -o hello_bof.o

run: COFFLoader.exe hello_bof.o
	./COFFLoader.exe go hello_bof.o

clean:
	rm -f COFFLoader.exe *.o *.obj
