diff --git a/Makefile b/Makefile index 1322092..6d49cee 100644 --- a/Makefile +++ b/Makefile @@ -28,19 +28,22 @@ CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar STRIP = $(CROSS_COMPILE)strip CFLAGS += -fPIC -g -Os -CPPFLAGS += -W -Wall +CPPFLAGS += -W -Wall -Iinclude ARFLAGS = crus JUNK = *~ *.bak *.map .*.d DEADJOE *.gdb *.elf core core.* +LIBNAME = libuev prefix ?= /usr/local -datadir = $(prefix)/share/doc/libuev +libdir ?= $(prefix)/lib +datadir ?= $(prefix)/share/doc/$(LIBNAME) +incdir ?= $(prefix)/include/$(LIBNAME) DISTFILES = README LICENSE test.c +INCLUDES = uev.h queue.h OBJS := libuev.o SRCS := $(OBJS:.o=.c) DEPS := $(addprefix .,$(SRCS:.c=.d)) VER = 1 -LIBNAME = libuev SOLIB = $(LIBNAME).so.$(VER) SYMLIB = $(LIBNAME).so STATICLIB = $(LIBNAME).a @@ -69,24 +72,31 @@ $(STATICLIB): Makefile $(OBJS) @$(AR) $(ARFLAGS) $@ $(OBJS) install: strip - @install -d $(DESTDIR)$(prefix)/lib - @install -m 0644 $(SOLIB) $(DESTDIR)$(prefix)/lib/ - @ln -s $(DESTDIR)$(prefix)/lib/$(SOLIB) $(DESTDIR)$(prefix)/lib/$(SYMLIB) + @install -d $(DESTDIR)$(libdir) + @install $(SOLIB) $(DESTDIR)$(prefix)/lib/$(SOLIB) + @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 -d $(DESTDIR)$(datadir) @for file in $(DISTFILES); do \ install -m 0644 $$file $(DESTDIR)$(datadir)/$$file; \ done uninstall: - -@$(RM) $(DESTDIR)$(prefix)/lib/$(LIBNAME)* -@$(RM) -r $(DESTDIR)$(datadir) + -@$(RM) -r $(DESTDIR)$(incdir) + -@$(RM) $(DESTDIR)$(prefix)/lib/$(LIBNAME)* -strip: all +strip: $(TARGET) @printf " STRIP %s\n" $(TARGET) @$(STRIP) --strip-unneeded $(TARGET) test: Makefile test.o $(STATICLIB) @printf " TEST %s\n" $(STATICLIB) - @$(CC) -g -DNO_DEBUG -o test test.c $(STATICLIB) && ./test + @$(CC) $(CPPFLAGS) -g -o test test.c $(STATICLIB) && ./test clean: -@$(RM) $(TARGET) *.o test diff --git a/queue.h b/include/libuev/queue.h similarity index 100% rename from queue.h rename to include/libuev/queue.h diff --git a/libuev.h b/include/libuev/uev.h similarity index 98% rename from libuev.h rename to include/libuev/uev.h index f35e597..14688d1 100644 --- a/libuev.h +++ b/include/libuev/uev.h @@ -23,8 +23,8 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef LIBUEV_H_ -#define LIBUEV_H_ +#ifndef LIBUEV_UEV_H_ +#define LIBUEV_UEV_H_ #include "queue.h" @@ -101,7 +101,7 @@ void uev_exit (uev_t *ctx); uev_t *uev_ctx_create (void); void uev_ctx_delete (uev_t *uev); -#endif /* LIBUEV_H_ */ +#endif /* LIBUEV_UEV_H_ */ /** * Local Variables: diff --git a/libuev.c b/libuev.c index fde54f0..7eda59f 100644 --- a/libuev.c +++ b/libuev.c @@ -34,7 +34,7 @@ #include #include -#include "libuev.h" +#include "libuev/uev.h" static clock_t clock_tick = 0; diff --git a/test.c b/test.c index 38f85fe..23f5847 100644 --- a/test.c +++ b/test.c @@ -27,7 +27,7 @@ #include #include /* intptr_t */ -#include "libuev.h" +#include "libuev/uev.h" static int in, out; static int period = 0;