rules.mk 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Copyright (c) 2009 Openmoko Inc.
  2. #
  3. # Authors Daniel Mack <daniel@caiaq.de>
  4. # Holger Hans Peter Freyther <zecke@openmoko.org>
  5. # Christopher Hall <hsw@openmoko.com>
  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. CFLAGS += -Wall -Werror -I. -gstabs -mlong-calls -fno-builtin -Os -mc33pe $(INCLUDES)
  21. ASFLAGS = -mc33pe --fatal-warnings
  22. # protection in case some Makefile includes this too early
  23. .PHONY: this-is-included-too-early
  24. this-is-included-too-early:
  25. @echo This is rules.mk reporting an error
  26. @echo move the '"include"' to the bottom of the Makefile.
  27. @echo Otherwise the dependencies are not built in the correct order
  28. @exit 1
  29. # just so that all the REQUIRED_xxx can be evaluated
  30. .PHONY: requires
  31. true
  32. # some debugging rules
  33. # use this like: 'make print-PATH print-CFLAGS' to see the value of make variable PATH and CFLAGS
  34. print-%:
  35. @echo $* is $($*)
  36. # compilation rules
  37. %.o: %.c
  38. $(GCC) -MM $(CFLAGS) -MT $@ $< > ${@:.o=.d}
  39. $(GCC) -E $(CFLAGS) $< > ${@:.o=.p}
  40. $(GCC) $(CFLAGS) -c -o $@ -Wa,-ahl=${@:.o=.asm33} $<
  41. ${BUILD_PREFIX}%.o: %.c
  42. $(GCC) -MM $(CFLAGS) -MT $@ $< > ${@:.o=.d}
  43. $(GCC) -E $(CFLAGS) $< > ${@:.o=.p}
  44. $(GCC) $(CFLAGS) -c -o $@ -Wa,-ahl=${@:.o=.asm33} $<
  45. %.o: %.s
  46. ${AS} -o $@ ${ASFLAGS} -ahlsm=${@:.o=.lst} $<
  47. ${BUILD_PREFIX}%.o: %.s
  48. ${AS} -o $@ ${ASFLAGS} -ahlsm=${@:.o=.lst} $<
  49. # convert XPM to binary ICO format
  50. %.ico: %.xpm
  51. ${GRIFO_SCRIPTS}/xpm2icon --icon="$@" "$<"
  52. # convert PNG to C header file
  53. %.h: %.png ${IMAGE2HEADER}
  54. ${IMAGE2HEADER} --inverted --header-file="$@" --variable-name="$(notdir ${@:.h=_image})" "$<"
  55. ${BUILD_PREFIX}%.h: %.png ${IMAGE2HEADER}
  56. ${IMAGE2HEADER} --inverted --header-file="$@" --variable-name="$(notdir ${@:.h=_image})" "$<"
  57. -include $(wildcard *.d) dummy
  58. -include $(wildcard ${BUILD_PREFIX}*.d) dummy