Rules.mk 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #
  2. # Rules.mk
  3. #
  4. # USPi - An USB driver for Raspberry Pi written in C
  5. # Copyright (C) 2014-2015 R. Stange <rsta2@o2online.de>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. ifeq ($(strip $(USPIHOME)),)
  21. USPIHOME = ..
  22. endif
  23. -include $(USPIHOME)/Config.mk
  24. RASPPI ?= 2
  25. PREFIX ?= arm-none-eabi-
  26. CC = $(PREFIX)gcc
  27. AS = $(CC)
  28. LD = $(PREFIX)ld
  29. AR = $(PREFIX)ar
  30. ifeq ($(strip $(RASPPI)),1)
  31. ARCH ?= -march=armv6j -mtune=arm1176jzf-s -mfloat-abi=hard
  32. else
  33. ARCH ?= -march=armv7-a -mtune=cortex-a7 -mfloat-abi=hard
  34. endif
  35. AFLAGS += $(ARCH) -DRASPPI=$(RASPPI)
  36. CFLAGS += $(ARCH) -Wall -Wno-psabi -fsigned-char -fno-builtin -nostdinc -nostdlib \
  37. -std=gnu99 -undef -DRASPPI=$(RASPPI) -I $(USPIHOME)/include -O #-DNDEBUG
  38. %.o: %.S
  39. $(AS) $(AFLAGS) -c -o $@ $<
  40. %.o: %.c
  41. $(CC) $(CFLAGS) -c -o $@ $<
  42. clean:
  43. rm -f *.o *.a *.elf *.lst *.img *.cir *.map *~ $(EXTRACLEAN)