Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #
  2. # (C) Copyright 2007 Semihalf
  3. #
  4. # See file CREDITS for list of people who contributed to this
  5. # project.
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License as
  9. # published by the Free Software Foundatio; either version 2 of
  10. # the License, or (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, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. # MA 02111-1307 USA
  21. #
  22. ifeq ($(ARCH),ppc)
  23. LOAD_ADDR = 0x40000
  24. endif
  25. ifeq ($(ARCH),arm)
  26. LOAD_ADDR = 0x1000000
  27. endif
  28. include $(TOPDIR)/config.mk
  29. # Resulting ELF and binary exectuables will be named demo and demo.bin
  30. OUTPUT-$(CONFIG_API) = $(obj)demo
  31. #CFLAGS += -v
  32. SOBJS-$(CONFIG_API) += crt0.o
  33. COBJS-$(CONFIG_API) += demo.o
  34. ifeq ($(ARCH),ppc)
  35. SOBJS-$(CONFIG_API) += ppcstring.o
  36. endif
  37. OUTPUT := $(OUTPUT-y)
  38. COBJS := $(COBJS-y)
  39. SOBJS := $(SOBJS-y)
  40. LIBCOBJS-$(CONFIG_API) += glue.o
  41. LIBCOBJS-$(CONFIG_API) += crc32.o
  42. LIBCOBJS-$(CONFIG_API) += ctype.o
  43. LIBCOBJS-$(CONFIG_API) += string.o
  44. LIBCOBJS-$(CONFIG_API) += vsprintf.o
  45. LIBCOBJS-$(CONFIG_API) += libgenwrap.o
  46. LIBCOBJS := $(LIBCOBJS-y)
  47. LIBOBJS += $(addprefix $(obj),$(SOBJS))
  48. LIBOBJS += $(addprefix $(obj),$(COBJS))
  49. LIBOBJS += $(addprefix $(obj),$(LIBCOBJS))
  50. SRCS += $(COBJS:.o=.c)
  51. SRCS += $(LIBCOBJS:.o=.c)
  52. SRCS += $(SOBJS:.o=.S)
  53. OBJS := $(addprefix $(obj),$(COBJS))
  54. gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
  55. CPPFLAGS += -I..
  56. all: $(obj).depend $(OBJS) $(OUTPUT)
  57. #########################################################################
  58. $(OUTPUT): $(LIBOBJS)
  59. $(LD) -Ttext $(LOAD_ADDR) -o $@ $^ -L$(gcclibdir) -lgcc
  60. $(OBJCOPY) -O binary $@ $(OUTPUT).bin 2>/dev/null
  61. $(obj)crc32.c:
  62. @rm -f $(obj)crc32.c
  63. ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c
  64. $(obj)ctype.c:
  65. @rm -f $(obj)ctype.c
  66. ln -s $(src)../lib_generic/ctype.c $(obj)ctype.c
  67. $(obj)string.c:
  68. @rm -f $(obj)string.c
  69. ln -s $(src)../lib_generic/string.c $(obj)string.c
  70. $(obj)vsprintf.c:
  71. @rm -f $(obj)vsprintf.c
  72. ln -s $(src)../lib_generic/vsprintf.c $(obj)vsprintf.c
  73. ifeq ($(ARCH),ppc)
  74. $(obj)ppcstring.S:
  75. @rm -f $(obj)ppcstring.S
  76. ln -s $(src)../lib_ppc/ppcstring.S $(obj)ppcstring.S
  77. endif
  78. #########################################################################
  79. # defines $(obj).depend target
  80. include $(SRCTREE)/rules.mk
  81. sinclude $(obj).depend
  82. #########################################################################