Split libuev.c into smaller files to help linker

Split libuev.c into one file per watcher type, mostly to give a better
overview and ease of maintenance, but also to help the linker.

Unfortunately this steals a few bytes when linking a full blown app, but
for apps that, e.g., only need I/O watchers and no timers the resulting
binary will be smaller.  This applies to static binaries that are more
common in embedded systems.

$ size libuev.a libuev.so.1
   text	   data	    bss	    dec	    hex	filename
    999	      0	      0	    999	    3e7	main.o (ex libuev.a)
     90	      0	      0	     90	     5a	io.o (ex libuev.a)
    490	      0	      0	    490	    1ea	timer.o (ex libuev.a)
   4380	    696	      8	   5084	   13dc	libuev.so.1

Also, move uev.h back to top from include/libuev/uev.h since a separate
namespace is not needed after the removal of the OpenBSD queue.h copy.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2013-07-23 00:54:52 +02:00
1 parent 069294f28a
commit 9b5be13e62
7 files changed
+241 -128

No files matched your search

+4 -6
View File
@@ -36,11 +36,11 @@ LIBNAME = libuev
prefix ?= /usr/local
libdir ?= $(prefix)/lib
datadir ?= $(prefix)/share/doc/$(LIBNAME)
incdir ?= $(prefix)/include/$(LIBNAME)
incdir ?= $(prefix)/include
DISTFILES = README LICENSE test.c
INCLUDES = uev.h queue.h
HEADER = uev.h
OBJS := libuev.o
OBJS := main.o io.o timer.o
SRCS := $(OBJS:.o=.c)
DEPS := $(addprefix .,$(SRCS:.c=.d))
VER = 1
@@ -77,9 +77,7 @@ install: strip
@install $(STATICLIB) $(DESTDIR)$(prefix)/lib/$(STATICLIB)
@ln -sf $(SOLIB) $(DESTDIR)$(prefix)/lib/$(SYMLIB)
@install -d $(DESTDIR)$(incdir)
@for file in $(INCLUDES); do \
install -m 0644 include/libuev/$$file $(DESTDIR)$(incdir)/$$file; \
done
@install -m 0644 $(HEADER) $(DESTDIR)$(incdir)/$(HEADER)
@install -d $(DESTDIR)$(datadir)
@for file in $(DISTFILES); do \
install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \