vbos/usr.bin/test1/Makefile
Michael Shaw 0297f4a34c syscall: imeplement basic file IO syscalls
also fix a bug where the RAX register would be restored to its initial
state instead of carrying the syscall return value
2023-11-27 02:48:52 -05:00

42 lines
879 B
Makefile

# SPDX-License-Identifier: GPL-2.0-only
# usr.bin/test1/Makefile
#
# test1 is the first test program, to be removed later.
#
# This Makefile also serves as a template for other user programs.
CC := x86_64-elf-gcc
LD := x86_64-elf-ld
OUT := test1.elf
CSRC :=
SSRC := start.S
OBJ := $(CSRC:.c=.o) $(SSRC:.S=.o)
DEP := $(OBJ:.o=.d)
CFLAGS := -Wall -ffreestanding -mno-mmx -mno-sse2 -mno-sse -m64 -MMD -g
LDFLAGS := -nostdlib -static -m elf_x86_64
CURDIR := $(shell pwd | awk -F '/' '{print $$(NF-1),"/",$$NF}' | sed 's/ //g')
$(OUT): $(OBJ)
@$(LD) $^ $(LDFLAGS) -o $@
@echo " USR.LD $(CURDIR)/$@"
-include $(DEP)
%.o: %.S
@$(CC) $(CFLAGS) -c $< -o $@
@echo " USR.CC $(CURDIR)/$@"
%.o: %.c
@$(CC) $(CFLAGS) -c $< -o $@
@echo " USR.CC $(CURDIR)/$@"
clean:
@rm -rf $(OUT) $(OBJ) $(DEP)
install: $(OUT)
@cp $(OUT) ../../bin
@echo " INSTALL $(CURDIR)/$(OUT)"