home *** CD-ROM | disk | FTP | other *** search
Makefile | 1986-07-21 | 3.9 KB | 155 lines |
- # String library.
-
- # Configuration settings: how should "size_t", "void *", "const" be written?
- # "size_t" is what's needed to hold the result of sizeof; beware of problems
- # with compatibility here, because X3J11 uses this for e.g. the third
- # argument of strncpy() as well. You may need to make it "int" even if
- # this is a lie. "void *" is the generic pointer type, "char *" in most
- # existing implementations. "const" is the keyword marking read-only
- # variables and parameters, unimplemented in most existing implementations.
- # These things need to be defined this way because they must be fitted into
- # both the .h files and the .c files; see the make instructions for string.h
- # farther down.
- #SIZET = int
- #VOIDSTAR = char *
- #LVOIDSTAR = char* # Lint shell file has problems with * alone. Barf.
- #CONST =
-
- #CONF = -DSIZET=$(SIZET) -DVOIDSTAR='$(VOIDSTAR)' -DCONST='$(CONST)'
- #LCONF = -DSIZET=$(SIZET) -DVOIDSTAR='$(LVOIDSTAR)' -DCONST='$(CONST)'
-
- # Things you might want to put in CFLAGS or LINTFLAGS.
- # -DCHARBITS=0377 Required if compiler lacks "unsigned char".
- # -Dvoid=int Required if compiler lacks "void".
- # -DUNIXERR Unix-like errno stuff, can test strerror().
- # -DBERKERR Like UNIXERR but for Berklix (4BSD).
- # -I. string.h from here, not /usr/include.
-
- CC = cc
- CFLAGS = -O $(CONF)
- LINTFLAGS = -hpan $(LCONF) -DUNIXERR -Dvoid=int -DCHARBITS=0377 -I.
- LDFLAGS = -i
-
- # Name lists.
- STRING1 = index.o rindex.o strcat.o strchr.o strcmp.o strcpy.o
- STRING2 = strcspn.o strlen.o strncat.o strncmp.o strncpy.o strpbrk.o
- STRING3 = strrchr.o strspn.o strtok.o strstr.o memcpy.o memccpy.o
- STRING4 = memcmp.o memchr.o memset.o bcopy.o bcmp.o bzero.o
- STRING5 = strerror.o
- STRING = $(STRING1) $(STRING2) $(STRING3) $(STRING4) $(STRING5)
-
- CSTRING = index.c rindex.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c \
- strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strspn.c \
- strtok.c strstr.c memcpy.c memccpy.c memcmp.c memchr.c memset.c \
- bcopy.c bcmp.c bzero.c strerror.c
- DTR = README Makefile $(CSTRING) tester.c string.proto
-
- # Locations, for installation (somewhat system-dependent).
- DEST=..
-
- all : $(STRING)
- bcmp.o : bcmp.c
- $(CC) -c $(CFLAGS) bcmp.c
-
- bcopy.o : bcopy.c
- $(CC) -c $(CFLAGS) bcopy.c
-
- bzero.o : bzero.c
- $(CC) -c $(CFLAGS) bzero.c
-
- index.o : index.c
- $(CC) -c $(CFLAGS) index.c
-
- memccpy.o : memccpy.c
- $(CC) -c $(CFLAGS) memccpy.c
-
- memchr.o : memchr.c
- $(CC) -c $(CFLAGS) memchr.c
-
- memcmp.o : memcmp.c
- $(CC) -c $(CFLAGS) memcmp.c
-
- memcpy.o : memcpy.c
- $(CC) -c $(CFLAGS) memcpy.c
-
- memset.o : memset.c
- $(CC) -c $(CFLAGS) memset.c
-
- rindex.o : rindex.c
- $(CC) -c $(CFLAGS) rindex.c
-
- strcat.o : strcat.c
- $(CC) -c $(CFLAGS) strcat.c
-
- strchr.o : strchr.c
- $(CC) -c $(CFLAGS) strchr.c
-
- strcmp.o : strcmp.c
- $(CC) -c $(CFLAGS) strcmp.c
-
- strcpy.o : strcpy.c
- $(CC) -c $(CFLAGS) strcpy.c
-
- strcspn.o : strcspn.c
- $(CC) -c $(CFLAGS) strcspn.c
-
- strerror.o : strerror.c
- $(CC) -c $(CFLAGS) strerror.c
-
- strlen.o : strlen.c
- $(CC) -c $(CFLAGS) strlen.c
-
- strncat.o : strncat.c
- $(CC) -c $(CFLAGS) strncat.c
-
- strncmp.o : strncmp.c
- $(CC) -c $(CFLAGS) strncmp.c
-
- strncpy.o : strncpy.c
- $(CC) -c $(CFLAGS) strncpy.c
-
- strpbrk.o : strpbrk.c
- $(CC) -c $(CFLAGS) strpbrk.c
-
- strrchr.o : strrchr.c
- $(CC) -c $(CFLAGS) strrchr.c
-
- strspn.o : strspn.c
- $(CC) -c $(CFLAGS) strspn.c
-
- strstr.o : strstr.c
- $(CC) -c $(CFLAGS) strstr.c
-
- strtok.o : strtok.c
- $(CC) -c $(CFLAGS) strtok.c
-
- tester.o : tester.c string.h
- $(CC) -c $(CFLAGS) tester.c
-
- mv : $(STRING)
- mv $(STRING) $(DEST)
-
- r : tester
- @echo 'No news is good news. Note: strerror() test is VERY system-dependent.'
- tester
-
- tester : tester.o $(STRING)
- cc $(LDFLAGS) tester.o $(STRING) -o tester
-
- string.h : string.proto
- sed 's/SIZET/$(SIZET)/g;s/VOIDSTAR /$(VOIDSTAR)/g' string.proto >string.h
-
- memory.h : string.h
- egrep mem string.h >memory.h
-
- lint : string.h
- lint $(LINTFLAGS) tester.c $(CSTRING)
-
- clean :
- rm -f tester a.out *.o string.h memory.h dtr
-
- dtr : $(DTR)
- makedtr $(DTR) >dtr
-
-
-