Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

119 lines
3.7 KiB

  1. prefix=/usr/local
  2. LIBDIR=${prefix}/lib
  3. INCLUDEDIR=${prefix}/include
  4. MAN3DIR=${prefix}/man/man3
  5. all: t byte.a fmt.a scan.a str.a uint.a open.a stralloc.a unix.a socket.a buffer.a mmap.a libowfat.a
  6. VPATH=str:byte:fmt:scan:uint:open:stralloc:unix:socket:buffer:mmap:textcode
  7. # comment out the following line if you don't want to build with the
  8. # diet libc (http://www.fefe.de/dietlibc/).
  9. DIET=diet -Os
  10. CC=gcc
  11. CFLAGS=-I. -pipe -Wall -O2 -pipe -fomit-frame-pointer
  12. #CFLAGS=-pipe -Os -march=pentiumpro -mcpu=pentiumpro -fomit-frame-pointer -fschedule-insns2 -Wall
  13. BYTE_OBJS=$(patsubst byte/%.c,%.o,$(wildcard byte/*.c))
  14. FMT_OBJS=$(patsubst fmt/%.c,%.o,$(wildcard fmt/*.c))
  15. SCAN_OBJS=$(patsubst scan/%.c,%.o,$(wildcard scan/*.c))
  16. STR_OBJS=$(patsubst str/%.c,%.o,$(wildcard str/*.c))
  17. UINT_OBJS=$(patsubst uint/%.c,%.o,$(wildcard uint/*.c))
  18. OPEN_OBJS=$(patsubst open/%.c,%.o,$(wildcard open/*.c))
  19. STRA_OBJS=$(patsubst stralloc/%.c,%.o,$(wildcard stralloc/*.c))
  20. UNIX_OBJS=$(patsubst unix/%.c,%.o,$(wildcard unix/*.c))
  21. SOCKET_OBJS=$(patsubst socket/%.c,%.o,$(wildcard socket/*.c))
  22. BUFFER_OBJS=$(patsubst buffer/%.c,%.o,$(wildcard buffer/*.c))
  23. MMAP_OBJS=$(patsubst mmap/%.c,%.o,$(wildcard mmap/*.c))
  24. TEXTCODE_OBJS=$(patsubst textcode/%.c,%.o,$(wildcard textcode/*.c))
  25. $(BYTE_OBJS): byte.h
  26. $(FMT_OBJS): fmt.h
  27. $(SCAN_OBJS): scan.h
  28. $(STR_OBJS): str.h
  29. $(UINT_OBJS): uint16.h uint32.h
  30. $(STRA_OBJS): stralloc.h
  31. $(SOCKET_OBJS): socket.h
  32. $(BUFFER_OBJS): buffer.h
  33. $(MMAP_OBJS): mmap.h
  34. $(TEXTCODE_OBJS): textcode.h
  35. byte.a: $(BYTE_OBJS)
  36. fmt.a: $(FMT_OBJS)
  37. scan.a: $(SCAN_OBJS)
  38. str.a: $(STR_OBJS)
  39. uint.a: $(UINT_OBJS)
  40. open.a: $(OPEN_OBJS)
  41. stralloc.a: $(STRA_OBJS)
  42. unix.a: $(UNIX_OBJS)
  43. socket.a: $(SOCKET_OBJS)
  44. buffer.a: $(BUFFER_OBJS)
  45. mmap.a: $(MMAP_OBJS)
  46. textcode.a: $(TEXTCODE_OBJS)
  47. libowfat.a: $(BYTE_OBJS) $(FMT_OBJS) $(SCAN_OBJS) $(STR_OBJS) \
  48. $(UINT_OBJS) $(OPEN_OBJS) $(STRA_OBJS) $(UNIX_OBJS) $(SOCKET_OBJS) \
  49. $(BUFFER_OBJS) $(MMAP_OBJS) $(TEXTCODE_OBJS)
  50. %.o: %.c
  51. $(DIET) $(CC) -c $< -o $@ $(CFLAGS)
  52. %.a:
  53. ar cr $@ $^
  54. -ranlib $@
  55. t: t.o socket.a stralloc.a buffer.a scan.a uint.a mmap.a open.a fmt.a \
  56. str.a byte.a textcode.a
  57. $(DIET) $(CC) -g -o $@ $^
  58. .PHONY: clean tar install rename
  59. clean:
  60. rm -f *.o *.a *.da *.bbg *.bb core t haveip6.h haven2i.h havesl.h haveinline.h
  61. install: libowfat.a
  62. install -d $(INCLUDEDIR) $(MAN3DIR) $(LIBDIR)
  63. install -m 644 buffer.h byte.h fmt.h ip4.h ip6.h mmap.h scan.h socket.h str.h stralloc.h uint16.h uint32.h uint64.h open.h $(INCLUDEDIR)
  64. install -m 644 $(wildcard */*.3) $(MAN3DIR)
  65. install -m 644 libowfat.a $(LIBDIR)
  66. VERSION=libowfat-$(shell head -1 CHANGES|sed 's/://')
  67. CURNAME=$(notdir $(shell pwd))
  68. tar: clean rename
  69. cd ..; tar cvvf $(VERSION).tar.bz2 $(VERSION) --use=bzip2 --exclude CVS
  70. rename:
  71. if test $(CURNAME) != $(VERSION); then cd .. && mv $(CURNAME) $(VERSION); fi
  72. haveip6.h:
  73. -rm -f $@
  74. if $(DIET) $(CC) -c tryip6.c >/dev/null 2>&1; then echo "#define LIBC_HAS_IP6"; fi > $@
  75. -rm -f tryip6.o
  76. haven2i.h:
  77. -rm -f $@
  78. if $(DIET) $(CC) -o t tryn2i.c >/dev/null 2>&1; then echo "#define HAVE_N2I"; fi > $@
  79. -rm -f t
  80. havesl.h:
  81. -rm -f $@
  82. if ! $(DIET) $(CC) -o t trysl.c >/dev/null 2>&1; then echo "typedef int socklen_t;"; fi > $@
  83. -rm -f t
  84. haveinline.h:
  85. -rm -f $@
  86. if ! $(DIET) $(CC) -c tryinline.c >/dev/null 2>&1; then echo "#define inline"; fi > $@
  87. -rm -f tryip6.o
  88. socket_accept6.o socket_connect6.o socket_local6.o socket_mchopcount6.o \
  89. socket_mcjoin6.o socket_mcleave6.o socket_mcloop6.o socket_recv6.o \
  90. socket_remote6.o socket_send6.o socket_tcp6.o socket_udp6.o: haveip6.h
  91. socket_getifidx.o socket_getifname.o: haven2i.h
  92. socket_accept4.o socket_accept6.o socket_connected.o socket_local4.o \
  93. socket_local6.o socket_recv4.o socket_recv6.o socket_remote4.o \
  94. socket_remote6.o: havesl.h
  95. fmt_xlong.o scan_xlong.o fmt_ip6_flat.o $(TEXTCODE_OBJS): haveinline.h