Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #
  2. # Copyright (C) 2008 by egnite GmbH
  3. # Copyright (C) 2001-2006 by egnite Software GmbH
  4. #
  5. # All rights reserved.
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions
  9. # are met:
  10. #
  11. # 1. Redistributions of source code must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. # 2. Redistributions in binary form must reproduce the above copyright
  14. # notice, this list of conditions and the following disclaimer in the
  15. # documentation and/or other materials provided with the distribution.
  16. # 3. Neither the name of the copyright holders nor the names of
  17. # contributors may be used to endorse or promote products derived
  18. # from this software without specific prior written permission.
  19. #
  20. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  23. # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  24. # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  25. # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  26. # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  27. # OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  28. # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  29. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  30. # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31. # SUCH DAMAGE.
  32. #
  33. # For additional information see http://www.ethernut.de/
  34. #
  35. PROJ = libnutcrt
  36. top_srcdir = ..
  37. top_blddir = ..
  38. LIBDIR = $(top_blddir)/lib
  39. include $(top_srcdir)/NutConf.mk
  40. include $(top_srcdir)/Makedefs
  41. SRCC = close.c clrerr.c ioctl.c open.c getf.c read.c putf.c write.c fclose.c \
  42. fcloseall.c fdopen.c feof.c ferror.c fflush.c filelength.c fileno.c flushall.c \
  43. fmode.c fopen.c fpurge.c freopen.c fseek.c ftell.c seek.c tell.c fgetc.c fgets.c \
  44. fread.c fscanf.c getc.c getchar.c gets.c kbhit.c scanf.c ungetc.c vfscanf.c \
  45. fprintf.c fputc.c fputs.c fwrite.c printf.c putc.c putchar.c puts.c vfprintf.c \
  46. sprintf.c sscanf.c vsprintf.c vsscanf.c gmtime.c localtim.c mktime.c time.c \
  47. tzset.c errno.c malloc.c environ.c getenv.c putenv.c setenv.c
  48. SRCCP = fprintf_p.c fputs_p.c fscanf_p.c fwrite_p.c printf_p.c puts_p.c \
  49. scanf_p.c sprintf_p.c sscanf_p.c vfprintf_p.c vfscanf_p.c \
  50. vsprintf_p.c vsscanf_p.c write_p.c
  51. ifneq (, $(findstring __HARVARD_ARCH__, $(HWDEF)))
  52. # Include _P functions for Harvard based MCUs
  53. SRCC += $(SRCCP)
  54. endif
  55. ifneq (, $(findstring h8300, $(ARCH)))
  56. # Include errno definition for H8 based MCUs
  57. SRCC += errno.c
  58. endif
  59. SRCS = $(SRCC) putf.c getf.c
  60. SRCF = $(SRCC) putff.c getff.c
  61. OBJS = $(SRCS:.c=.o)
  62. OBJF = $(SRCF:.c=.o)
  63. TARG = $(PROJ).a
  64. TARGF = $(PROJ)f.a
  65. TARGS = $(TARG) $(TARGF)
  66. all: $(TARGS)
  67. include $(top_srcdir)/Makerules
  68. $(TARG): $(OBJS)
  69. $(AR) $(ARFLAGS) $(TARG) $(OBJS)
  70. $(TARGF): $(OBJF)
  71. $(AR) $(ARFLAGS) $(TARGF) $(OBJF)
  72. install: $(TARGS)
  73. $(CP) $(TARG) $(LIBDIR)/$(TARG)
  74. $(CP) $(TARGF) $(LIBDIR)/$(TARGF)
  75. ifeq ($(ARCH), unix)
  76. $(RANLIB) $(LIBDIR)/$(TARG)
  77. $(RANLIB) $(LIBDIR)/$(TARGF)
  78. endif
  79. clean:
  80. @echo " [CLEANING] $(TARGS)..."
  81. @-rm -f $(OBJS)
  82. @-rm -f $(OBJF)
  83. @-rm -f $(TARGS)
  84. @-rm -f $(SRCS:.c=.lst) $(SRCF:.c=.lst)
  85. @-rm -f $(SRCS:.c=.lis) $(SRCF:.c=.lis)
  86. @-rm -f $(SRCS:.c=.s) $(SRCF:.c=.s)
  87. @-rm -f $(SRCS:.c=.bak) $(SRCF:.c=.bak)
  88. @-rm -f $(SRCS:.c=.c~) $(SRCF:.c=.c~)
  89. @-rm -f $(SRCS:.c=.i) $(SRCF:.c=.i)