Advertisement
Guest User

makefile

a guest
Nov 5th, 2021
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. KSRCS = $(shell find -name '*.cxx' -o -name '*.s')
  2. KOBJS = $(addsuffix .o,$(basename $(KSRCS)))
  3. KERN = kernel.elf
  4.  
  5. CC = cc
  6. CCX = g++
  7. LD = ld
  8.  
  9. KASFLAGS = -m64
  10. KCXXFLAGS = -std=c++11 -m64 -Os -W -Wall -Wextra -nostdlib -fno-exceptions -fno-rtti -fno-stack-protector
  11. KLDFLAGS = -z max-page-size=0x1000 -Tlinker.ld
  12.  
  13. $(KERN): $(KOBJS)
  14. $(LD) $(KLDFLAGS) -o $@ $^
  15.  
  16. %.o: %.cxx
  17. $(CCX) $(KCXXFLAGS) -c -o $@ $^
  18.  
  19. %.o: %.c
  20. $(CC) $(KCCFLAGS) -c -o $@ $^
  21.  
  22. %.o: %.s
  23. $(CC) $(KASFLAGS) -c -o $@ $^
  24.  
  25. clean:
  26. rm -f $(KOBJS)
  27.  
  28. distclean:
  29. rm -f $(KOBJS)
  30. rm -f $(KERN)
  31.  
  32. .PHONY: clean
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement