TARGET = usrbin_blob.o LIB = ../lib/lib.a SRCS = $(wildcard *.c) ASMS = $(wildcard *.s) OBJS = $(SRCS:.c=.o) $(ASMS:.s=.o) CFLAGS = -m32 -I../include -ffreestanding -nostdinc -nostdlib -fno-stack-protector -fno-pie -g LDFLAGS = -m elf_i386 -T link.ld ASMFLAGS = -f elf32 CC = gcc $(CFLAGS) LD = ld $(LDFLAGS) ASM = nasm $(ASMFLAGS) all: build build: $(TARGET) .s.o: $(ASM) -o $*.o $^ .c.o: $(CC) -c -o $*.o $^ $(TARGET): $(OBJS) $(LD) -o usrbin.bin $(OBJS) $(LIB) objcopy -I binary -O elf32-i386 -B i386 usrbin.bin $(TARGET) \ --redefine-sym _binary_usrbin_bin_start=_usrbin_start \ --redefine-sym _binary_usrbin_bin_end=_usrbin_end \ --redefine-sym _binary_usrbin_bin_size=_usrbin_size clean: rm -f usrbin.bin rm -f $(OBJS) rm -f $(TARGET)