usr.bin: add usr.bin

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-18 15:28:53 -04:00
commit f47a4bfa2c
8 changed files with 87 additions and 11 deletions

30
usr.bin/Makefile.common Normal file
View file

@ -0,0 +1,30 @@
ifneq ($(V),1)
Q := @
else
Q :=
endif
USR_CFLAGS ?= -g3 -O0 -pipe -Wall -ffreestanding -nostdlib \
-fno-stack-protector -m64 -march=x86-64 -mabi=sysv \
-Iinclude -MMD
USR_LDFLAGS ?= -nostdlib -static -m elf_x86_64 -z max-page-size=0x1000
$(OUT): $(UOBJ)
$(Q)echo " LD [U] $(DIR)/$@"
$(Q)$(LD) $(USR_LDFLAGS) -o $@ $^
%.o: %.c
$(Q)echo " CC [U] $(DIR)/$@"
$(Q)$(CC) $(USR_CFLAGS) -c $< -o $@
%.o: %.S
$(Q)echo " CC [U] $(DIR)/$@"
$(Q)$(CC) $(USR_CFLAGS) -c $< -o $@
clean:
$(Q)rm -rf $(UOBJ) $(OUT)
print-%:
$(Q)echo $($(*))