Newer
Older
honey-os / src / userland / ps2 / Makefile
  1. CC = i686-elf-gcc
  2. CCFLAGS = -m32 -mtune=generic -ffreestanding -nostdlib -c -I ../../include -I include -Wno-discarded-qualifiers -fms-extensions -Wno-shift-count-overflow -O0
  3. LD = i686-elf-ld
  4. LD_FLAGS = -z max-page-size=0x1000 -T ../link.ld
  5. AS = nasm
  6. ASFlAGS = -felf32
  7.  
  8. BUILD_FOLDER = build
  9.  
  10. SOURCE_FILES := $(shell find . -name *.c -or -name *.asm -or -name *.s)
  11. OBJS := $(SOURCE_FILES:%=$(BUILD_FOLDER)/%.o)
  12.  
  13. NAME = ps2
  14.  
  15. ../../../initrd/$(NAME): $(OBJS) ../../../build/hlib.o
  16. @echo "linking user program $(NAME)"
  17. @$(LD) $(LD_FLAGS) -o ../../../initrd/$(NAME) $(OBJS)
  18.  
  19. $(BUILD_FOLDER)/%.asm.o: %.asm
  20. @echo "asembling $<"
  21. @mkdir -p $(dir $@)
  22. @$(AS) $(ASFlAGS) $< -o $@
  23.  
  24. $(BUILD_FOLDER)/%.c.o: %.c
  25. @echo "compiling $<"
  26. @mkdir -p $(dir $@)
  27. @$(CC) $(CCFLAGS) -r $< -o $@
  28.  
  29. clean:
  30. @echo "clearing build folder"
  31. @rm -r $(BUILD_FOLDER)