2020-11-12 01:57:05 +01:00
|
|
|
PROGRAM=example
|
2020-11-12 01:43:46 +01:00
|
|
|
SOURCES=syscalls.o colors.go.o colors.gox os.go.o os.gox $(PROGRAM).go.o
|
|
|
|
LIBOBJ=os.go.o syscalls.o colors.go.o
|
2020-05-03 11:30:20 +02:00
|
|
|
GOFLAGS= -nostdlib -nostdinc -fno-stack-protector -fno-split-stack -static -m32 -g -I.
|
|
|
|
GO=gccgo
|
|
|
|
ASFLAGS= -felf
|
|
|
|
NASM= nasm $(ASFLAGS)
|
|
|
|
OBJCOPY=objcopy
|
2020-11-12 01:43:46 +01:00
|
|
|
|
2020-05-03 11:30:20 +02:00
|
|
|
LDFLAGS=-T static.lds -n -m elf_i386
|
|
|
|
|
2020-11-12 01:43:46 +01:00
|
|
|
|
2020-05-03 11:30:20 +02:00
|
|
|
all: $(SOURCES) link
|
2020-11-12 01:43:46 +01:00
|
|
|
clean:
|
|
|
|
rm *.o *.gox $(PROGRAM).kex
|
2020-05-03 11:30:20 +02:00
|
|
|
link:
|
2020-11-12 01:43:46 +01:00
|
|
|
ld $(LDFLAGS) -o $(PROGRAM).kex $(SOURCES)
|
|
|
|
$(OBJCOPY) $(PROGRAM).kex -O binary
|
2020-05-03 11:30:20 +02:00
|
|
|
%.gox: %.go.o
|
2020-11-12 01:43:46 +01:00
|
|
|
$(OBJCOPY) -j .go_export $< $@
|
2020-05-03 11:30:20 +02:00
|
|
|
%.go.o: %.go
|
2020-11-12 01:43:46 +01:00
|
|
|
$(GO) $(GOFLAGS) -o $@ -c $<
|
2020-05-03 11:30:20 +02:00
|
|
|
%.o: %.s
|
|
|
|
$(NASM) $<
|