kolibrios/programs/develop/golang/example/Makefile
Rustem Gimadutdinov (rgimad) 227e2de7d9 golang: fixed build errors and some refactoring
git-svn-id: svn://kolibrios.org@9298 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-11-21 21:10:17 +00:00

27 lines
632 B
Makefile

PROGRAM=example
OBJS=../syscalls.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 -g -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) $<