Makefile 839 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #
  2. # Makefile for Gemin kernel copy stub
  3. #
  4. # Copyright (C) 2019 Linus Walleij <[email protected]>
  5. #
  6. # This program is free software; you can redistribute it and/or modify it
  7. # under the terms of the GNU General Public License version 2 as published
  8. # by the Free Software Foundation.
  9. #
  10. AS := $(CROSS_COMPILE)as
  11. OBJCOPY := $(CROSS_COMPILE)objcopy
  12. BIN_FLAGS := -O binary -S
  13. SRC_DIR := $(CURDIR)/
  14. OUT_DIR := $(if $(O),$(if $(patsubst %/,,$(O)),$(O)/,$(O)),$(SRC_DIR))
  15. all: $(OUT_DIR)copy-kernel.bin
  16. # Don't build dependencies, this may die if $(CC) isn't gcc
  17. dep:
  18. install:
  19. $(OUT_DIR):
  20. mkdir -p $(OUT_DIR)
  21. $(OUT_DIR)%.o : $(SRC_DIR)%.S | $(OUT_DIR)
  22. $(AS) $(ASFLAGS) -k -o $@ $<
  23. $(OUT_DIR)%.bin: $(OUT_DIR)%.o
  24. $(OBJCOPY) $(BIN_FLAGS) $< $@
  25. mrproper: clean
  26. clean:
  27. rm -f $(OUT_DIR)copy-kernel.bin $(OUT_DIR)copy-kernel.o