home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d0xx / d029 / stringlib.lha / StringLib / Makefile < prev    next >
Encoding:
Makefile  |  1986-07-21  |  3.9 KB  |  155 lines

  1. # String library.
  2.  
  3. # Configuration settings:  how should "size_t", "void *", "const" be written?
  4. # "size_t" is what's needed to hold the result of sizeof; beware of problems
  5. # with compatibility here, because X3J11 uses this for e.g. the third
  6. # argument of strncpy() as well.  You may need to make it "int" even if
  7. # this is a lie.  "void *" is the generic pointer type, "char *" in most
  8. # existing implementations.  "const" is the keyword marking read-only
  9. # variables and parameters, unimplemented in most existing implementations.
  10. # These things need to be defined this way because they must be fitted into
  11. # both the .h files and the .c files; see the make instructions for string.h
  12. # farther down.
  13. #SIZET = int
  14. #VOIDSTAR = char *
  15. #LVOIDSTAR = char*    # Lint shell file has problems with * alone.  Barf.
  16. #CONST = 
  17.  
  18. #CONF = -DSIZET=$(SIZET) -DVOIDSTAR='$(VOIDSTAR)' -DCONST='$(CONST)'
  19. #LCONF = -DSIZET=$(SIZET) -DVOIDSTAR='$(LVOIDSTAR)' -DCONST='$(CONST)'
  20.  
  21. # Things you might want to put in CFLAGS or LINTFLAGS.
  22. # -DCHARBITS=0377        Required if compiler lacks "unsigned char".
  23. # -Dvoid=int            Required if compiler lacks "void".
  24. # -DUNIXERR            Unix-like errno stuff, can test strerror().
  25. # -DBERKERR            Like UNIXERR but for Berklix (4BSD).
  26. # -I.                string.h from here, not /usr/include.
  27.  
  28. CC =        cc
  29. CFLAGS =    -O $(CONF)
  30. LINTFLAGS =    -hpan $(LCONF) -DUNIXERR -Dvoid=int -DCHARBITS=0377 -I.
  31. LDFLAGS =    -i
  32.  
  33. # Name lists.
  34. STRING1 =    index.o rindex.o strcat.o strchr.o strcmp.o strcpy.o
  35. STRING2 =    strcspn.o strlen.o strncat.o strncmp.o strncpy.o strpbrk.o
  36. STRING3 =    strrchr.o strspn.o strtok.o strstr.o memcpy.o memccpy.o
  37. STRING4 =    memcmp.o memchr.o memset.o bcopy.o bcmp.o bzero.o
  38. STRING5 =    strerror.o
  39. STRING =    $(STRING1) $(STRING2) $(STRING3) $(STRING4) $(STRING5)
  40.  
  41. CSTRING = index.c rindex.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
  42.     strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strspn.c \
  43.     strtok.c strstr.c memcpy.c memccpy.c memcmp.c memchr.c memset.c \
  44.     bcopy.c bcmp.c bzero.c strerror.c
  45. DTR = README Makefile $(CSTRING) tester.c string.proto
  46.  
  47. # Locations, for installation (somewhat system-dependent).
  48. DEST=..
  49.  
  50. all :        $(STRING)
  51. bcmp.o :    bcmp.c
  52.         $(CC) -c $(CFLAGS) bcmp.c
  53.  
  54. bcopy.o :    bcopy.c
  55.         $(CC) -c $(CFLAGS) bcopy.c
  56.  
  57. bzero.o :    bzero.c
  58.         $(CC) -c $(CFLAGS) bzero.c
  59.  
  60. index.o :    index.c
  61.         $(CC) -c $(CFLAGS) index.c
  62.  
  63. memccpy.o :    memccpy.c
  64.         $(CC) -c $(CFLAGS) memccpy.c
  65.  
  66. memchr.o :    memchr.c
  67.         $(CC) -c $(CFLAGS) memchr.c
  68.  
  69. memcmp.o :    memcmp.c
  70.         $(CC) -c $(CFLAGS) memcmp.c
  71.  
  72. memcpy.o :    memcpy.c
  73.         $(CC) -c $(CFLAGS) memcpy.c
  74.  
  75. memset.o :    memset.c
  76.         $(CC) -c $(CFLAGS) memset.c
  77.  
  78. rindex.o :    rindex.c
  79.         $(CC) -c $(CFLAGS) rindex.c
  80.  
  81. strcat.o :    strcat.c
  82.         $(CC) -c $(CFLAGS) strcat.c
  83.  
  84. strchr.o :    strchr.c
  85.         $(CC) -c $(CFLAGS) strchr.c
  86.  
  87. strcmp.o :    strcmp.c
  88.         $(CC) -c $(CFLAGS) strcmp.c
  89.  
  90. strcpy.o :    strcpy.c
  91.         $(CC) -c $(CFLAGS) strcpy.c
  92.  
  93. strcspn.o :    strcspn.c
  94.         $(CC) -c $(CFLAGS) strcspn.c
  95.  
  96. strerror.o :    strerror.c
  97.         $(CC) -c $(CFLAGS) strerror.c
  98.  
  99. strlen.o :    strlen.c
  100.         $(CC) -c $(CFLAGS) strlen.c
  101.  
  102. strncat.o :    strncat.c
  103.         $(CC) -c $(CFLAGS) strncat.c
  104.  
  105. strncmp.o :    strncmp.c
  106.         $(CC) -c $(CFLAGS) strncmp.c
  107.  
  108. strncpy.o :    strncpy.c
  109.         $(CC) -c $(CFLAGS) strncpy.c
  110.  
  111. strpbrk.o :    strpbrk.c
  112.         $(CC) -c $(CFLAGS) strpbrk.c
  113.  
  114. strrchr.o :    strrchr.c
  115.         $(CC) -c $(CFLAGS) strrchr.c
  116.  
  117. strspn.o :    strspn.c
  118.         $(CC) -c $(CFLAGS) strspn.c
  119.  
  120. strstr.o :    strstr.c
  121.         $(CC) -c $(CFLAGS) strstr.c
  122.  
  123. strtok.o :    strtok.c
  124.         $(CC) -c $(CFLAGS) strtok.c
  125.  
  126. tester.o :    tester.c string.h
  127.         $(CC) -c $(CFLAGS) tester.c
  128.  
  129. mv :    $(STRING)
  130.     mv $(STRING) $(DEST)
  131.  
  132. r :    tester
  133.     @echo 'No news is good news.  Note: strerror() test is VERY system-dependent.'
  134.     tester
  135.  
  136. tester :    tester.o $(STRING)
  137.     cc $(LDFLAGS) tester.o $(STRING) -o tester
  138.  
  139. string.h :    string.proto
  140.     sed 's/SIZET/$(SIZET)/g;s/VOIDSTAR /$(VOIDSTAR)/g' string.proto >string.h
  141.  
  142. memory.h :    string.h
  143.     egrep mem string.h >memory.h
  144.  
  145. lint :    string.h
  146.     lint $(LINTFLAGS) tester.c $(CSTRING)
  147.  
  148. clean :
  149.     rm -f tester a.out *.o string.h memory.h dtr
  150.  
  151. dtr :    $(DTR)
  152.     makedtr $(DTR) >dtr
  153.  
  154.  
  155.