home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / rom / utility / makefile < prev    next >
Encoding:
Makefile  |  1997-02-07  |  3.6 KB  |  108 lines

  1. # $Id: makefile,v 1.30 1997/02/07 14:32:22 digulla Exp $
  2. TOP=../..
  3.  
  4. include $(TOP)/config/make.cfg
  5.  
  6. # BEGIN_DESC{makefile}
  7. # This is the makefile for utility.library. Use it if you want to compile
  8. # only this part of AROS.
  9. # END_DESC{makefile}
  10.  
  11. # BEGIN_DESC{localmakevar}
  12. # \item{FILES} This is a list of all files (without the .c) which
  13. #    contain internal functions of the library (eg. libinit(),
  14. #    libopen(), libexpunge() and the function table).
  15. #
  16. # \item{FUNCTIONS} This is a list of all files (without the .c)
  17. #    with public functions of the library. The makefile will
  18. #    strip all files from this list for which a special
  19. #    version for this CPU does exist.
  20. #
  21. # END_DESC{localmakevar}
  22. FILES = utility_init utility_functable getnamespace intfindnamedobj
  23. FUNCTIONS := \
  24.     applytagchanges callhookpkt findtagitem nexttagitem \
  25.     stricmp strnicmp tolower toupper getuniqueid \
  26.     date2amiga amiga2date allocatetagitems \
  27.     freetagitems clonetagitems gettagdata packbooltags \
  28.     refreshtagitemclones taginarray maptags \
  29.     addnamedobject allocnamedobjecta attemptremnamedobject \
  30.     findnamedobject namedobjectname releasenamedobject \
  31.     remnamedobject freenamedobject \
  32.     packstructuretags unpackstructuretags checkdate \
  33.     filtertagitems filtertagchanges \
  34.     smult32 umult32 smult64 umult64 sdivmod32 udivmod32
  35.  
  36. # BEGIN_DESC{localmakevar}
  37. # \item{ASM_PATH} The path to the assembler sources
  38. #
  39. # \item{ASM_FILES_TRY} Create a list with all files that might be
  40. #    found as special CPU versions in $(ASM_PATH) with full
  41. #    path.
  42. #
  43. # \item{ASM_FILES_EXIST} Create a list of all files from $(ASM_FILES_TRY)
  44. #    which do really exist in $(ASM_PATH).
  45. #
  46. # END_DESC{localmakevar}
  47.  
  48. ASM_PATH := $(TOP)/config/$(KERNEL)
  49.  
  50. ASM_FILES_TRY := $(foreach f,$(FUNCTIONS),$(ASM_PATH)/$(f).s)
  51. ASM_FILES_EXIST := $(wildcard $(ASM_FILES_TRY))
  52. ASM_FILES := $(basename $(notdir $(ASM_FILES_EXIST)))
  53.  
  54. # Black magic: First create a negative list of the files (ie. only the
  55. # ones which do *not* have a special assembler version for this CPU
  56. # and then strip the path and extensions from all files in this list.
  57. # Now the list contains the basenames of all files which must be taken
  58. # from the local directory.
  59. FUNCTIONS := $(filter-out $(ASM_FILES_EXIST),$(ASM_FILES_TRY))
  60. FUNCTIONS := $(basename $(notdir $(FUNCTIONS)))
  61.  
  62. ifeq ($(FLAVOUR),native)
  63. LIBS = -L$(LIBDIR) -larosc
  64.  
  65. all: setup \
  66.     $(foreach f,$(FILES) $(FUNCTIONS),$(OSGENDIR)/$(f).o) \
  67.     $(foreach f,$(FUNCTIONS) $(FUNCTIONS),$(OSGENDIR)/$(f).o) \
  68.     $(OSMODDIR)/utility.library
  69.  
  70. $(OSMODDIR)/utility.library: $(foreach f,$(FILES) $(FUNCTIONS),$(OSGENDIR)/$(f).o) \
  71.                  $(foreach f,$(FUNCTIONS) $(FUNCTIONS),$(OSGENDIR)/$(f).o) \
  72.                  $(foreach f,$(ASM_FILES),$(OSGENDIR)/$(f).o)
  73.     $(CC) $(ILDFLAGS) \
  74.     $(foreach f,$(FILES),$(OSGENDIR)/$(f).o) \
  75.     $(foreach f,$(FUNCTIONS),$(OSGENDIR)/$(f).o) \
  76.     $(foreach f,$(ASM_FILES),$(OSGENDIR)/$(f).o) \
  77.     $(LIBS) -o $@ 2>&1|tee utilitylib.err
  78.     @if test ! -s utilitylib.err; then rm utilitylib.err ; else true ; fi
  79.     @strip $@
  80. else
  81. all: setup \
  82.     $(foreach f,$(FILES) $(FUNCTIONS),$(OSGENDIR)/$(f).o)
  83. endif
  84.  
  85. setup :
  86.     @if [ ! -d $(OSGENDIR) ]; then $(MKDIR) $(OSGENDIR) ; else true ; fi
  87.  
  88. clean:
  89.     -$(RM) $(OSGENDIR) *.err $(LIBDIR)/libutility.a
  90.  
  91. $(OSGENDIR)/%.o: %.c
  92.     $(CC) $(SHARED_CFLAGS) $(CFLAGS) $< -c -o $@ 2>&1|tee $*.err
  93.     @if test ! -s $*.err; then rm $*.err ; else true ; fi
  94.  
  95. utility_functable.c: $(foreach f,$(FUNCTIONS),$(f).c) \
  96.         $(TOP)/scripts/makefunctable.awk
  97.     gawk -f $(TOP)/scripts/makefunctable.awk \
  98.         --assign lib=Utility \
  99.         $^
  100.  
  101. $(OSGENDIR)/%.d: %.c
  102.     @if [ ! -d $(@D) ]; then $(MKDIR) $(@D) ; else true ; fi
  103.     $(MKDEPEND) -f- -p$(@D)/ -- $(CFLAGS) -- $^ > $@
  104.  
  105. ifneq ($(TARGET),clean)
  106. include $(foreach f,$(FILES) $(FUNCTIONS),$(OSGENDIR)/$(f).d)
  107. endif
  108.