Advertisement
robdaemon

Untitled

Aug 12th, 2022 (edited)
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.13 KB | None | 0 0
  1. CC=aarch64-none-elf-gcc
  2. CFLAGS = -Iinclude -O0 -g -ffreestanding -Wall -Wextra -Werror
  3. LDFLAGS = -nostartfiles -nostdlib
  4. LIBS = -lgcc
  5.  
  6. ARCHDIR=src/arch/aarch64
  7. BSPDIR=src/bsp/rpi3
  8.  
  9. CSRCS = $(wildcard src/*.c) \
  10. $(wildcard $(ARCHDIR)/*.c) $(wildcard $(ARCHDIR)/*/*.c) \
  11. $(wildcard $(BSPDIR)/*.c) $(wildcard $(BSPDIR)/*/*.c) \
  12.  
  13. SSRCS = $(wildcard src/*.S) $(wildcard src/*/*.S) \
  14. $(wildcard $(ARCHDIR)/*.S) $(wildcard $(ARCHDIR)/*/*.S) \
  15. $(wildcard $(BSPDIR)/*.S) $(wildcard $(BSPDIR)/*/*.S) \
  16.  
  17. COBJS = $(patsubst %.c, %.o, $(CSRCS))
  18. SOBJS = $(patsubst %.S, %.o, $(SSRCS)) \
  19.  
  20. LINK_LIST=\
  21. $(LDFLAGS) \
  22. $(COBJS) \
  23. $(SOBJS) \
  24. $(LIBS) \
  25.  
  26. .PHONY: all clean
  27. .SUFFIXES: .o .c .S
  28.  
  29. all: plaid.elf
  30.  
  31. plaid.elf: $(OBJS) $(ARCHDIR)/linker.ld
  32.     $(info $$CSRCS is [${CSRCS}])
  33.     $(info $$SSRCS is [${SSRCS}])
  34.     $(info $$COBJS is [$(COBJS)])
  35.     $(info $$SOBJS is [$(SOBJS)])
  36.     $(CC) -T $(ARCHDIR)/linker.ld -o $@ $(CFLAGS) $(LINK_LIST)
  37.  
  38. %.o: %.c
  39.     $(CC) -MD -c $< -o $@ -std=gnu11 $(CFLAGS) $(CPPFLAGS)
  40.  
  41. %.o: %.S
  42.     $(CC) -MD -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
  43.  
  44. clean:
  45.     rm -f plaid.elf
  46.     rm -f  *.o */*.o */*/*.o
  47.     rm -f  *.d */*.d */*/*.d
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement