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
|
2021-07-12 14:28:41 +02:00
|
|
|
GOFLAGS = -m32 -c -nostdlib -nostdinc -fno-stack-protector -fno-split-stack -static -fno-leading-underscore -fno-common -fno-pie -g -I.
|
|
|
|
GO = gccgo
|
|
|
|
GCC = gcc
|
|
|
|
ASFLAGS= -g -f elf32 -F dwarf
|
2020-05-03 11:30:20 +02:00
|
|
|
NASM= nasm $(ASFLAGS)
|
|
|
|
OBJCOPY=objcopy
|
2021-07-12 14:28:41 +02:00
|
|
|
|
|
|
|
LDFLAGS=-n -T static.lds -m elf_i386 --no-ld-generated-unwind-info
|
|
|
|
|
|
|
|
|
2020-05-03 11:30:20 +02:00
|
|
|
all: $(SOURCES) link
|
2020-11-12 01:43:46 +01:00
|
|
|
clean:
|
2021-07-12 14:28:41 +02:00
|
|
|
rm -f *.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) $<
|