Archived
1
0
This repository has been archived on 2025-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
kos_go/example/Makefile
2023-06-11 03:26:44 +03:00

27 lines
648 B
Makefile

PROGRAM=example
OBJS=../syscalls.o ../runtime.go.o colors.go.o colors.gox ../kos.go.o ../kos.gox $(PROGRAM).go.o
GOFLAGS=-m32 -c -nostdlib -nostdinc -fno-stack-protector -fno-split-stack -static -fno-leading-underscore -fno-common -fno-pie -I.
GO=gccgo
ASFLAGS=-g -f elf32 -F dwarf
NASM=nasm $(ASFLAGS)
OBJCOPY=objcopy
LDFLAGS=-n -T ../static.lds -m elf_i386 --no-ld-generated-unwind-info
all: $(OBJS) link
clean:
rm -f $(OBJS) $(PROGRAM).kex
link:
ld $(LDFLAGS) -o $(PROGRAM).kex $(OBJS)
$(OBJCOPY) $(PROGRAM).kex -O binary
%.gox: %.go.o
$(OBJCOPY) -j .go_export $< $@
%.go.o: %.go
$(GO) $(GOFLAGS) -o $@ -c $<
%.o: %.asm
$(NASM) $<