Move test.c and joystick.c to examples/

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-02-15 18:13:09 +01:00
parent d1b9fd17f3
commit 5ecc6d64b4
6 changed files with 87 additions and 22 deletions
+16 -14
View File
@@ -1,4 +1,4 @@
# -*-Makefile-*- for libuEv
# libuEv main build file
#
# Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
# Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com>
@@ -22,7 +22,7 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
.PHONY: all test clean
.PHONY: all test clean joystick test examples
#VERSION = $(shell git tag -l | tail -1)
VERSION ?= 1.0.5-dev
@@ -36,7 +36,9 @@ STRIP ?= $(CROSS)strip
CFLAGS += -fPIC -Os
CPPFLAGS += -W -Wall -Werror
ARFLAGS = crus
JUNK = *~ *.bak *.map .*.d DEADJOE *.gdb *.elf core core.*
JUNK = *~ *.bak *.map .*.d DEADJOE *.gdb *.elf core core.* *.html
MAKEFLAGS = --no-print-directory
ROOTDIR ?= $(shell pwd)
LIBNAME = $(NAME)
@@ -56,11 +58,11 @@ SYMLIB = $(LIBNAME).so
STATICLIB = $(LIBNAME).a
TARGET = $(STATICLIB) $(SOLIB)
# Pretty printing and GCC -M for auto dep files
%.o: %.c
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MP -o $@ $<
export STATICLIB JUNK ROOTDIR CFLAGS CPPFLAGS
# This magic trick looks like a comment, but works on BSD PMake
#include <rules.mk>
include rules.mk
# Build rules
all: $(TARGET)
@@ -95,26 +97,26 @@ strip: $(TARGET)
@$(STRIP) --strip-unneeded $(TARGET)
@size $(TARGET)
test: Makefile test.o $(STATICLIB)
@printf " TEST %s\n" $(STATICLIB)
@$(CC) $(CPPFLAGS) -g -o test test.c $(STATICLIB) && ./test
bench: Makefile bench.o $(STATICLIB)
@printf " BENCH %s\n" $(STATICLIB)
@$(CC) $(CPPFLAGS) -g -o bench bench.c $(STATICLIB) && ./bench
joystick: Makefile joystick.o $(STATICLIB)
@printf " JOTST %s\n" $(STATICLIB)
@$(CC) $(CPPFLAGS) -g -o joystick joystick.c $(STATICLIB) && ./joystick
examples:
@$(MAKE) -C examples
test joystick:
@$(MAKE) -C examples $@
# Runs Clang scan-build on the whole tree
check: clean
@scan-build $(MAKE) all
clean:
-@$(MAKE) -C examples $@
-@$(RM) $(TARGET) *.o test joystick bench
distclean: clean
-@$(MAKE) -C examples $@
-@$(RM) $(DEPS) $(JUNK)
dist:
+8 -6
View File
@@ -1,7 +1,6 @@
libuEv | Simple event loop for Linux
====================================
[![Build Status](https://travis-ci.org/troglobit/libuev.png?branch=master)](https://travis-ci.org/troglobit/libuev)
[![Coverity Scan Status](https://scan.coverity.com/projects/3846/badge.svg)](https://scan.coverity.com/projects/3846)
[![Travis Status]][Travis] [![Coverity Status]][Coverity Scan]
Table of Contents
@@ -249,12 +248,15 @@ used for inspiration is the very small [Picoev][9] by [Oku Kazuho].
[7]: http://libev.schmorp.de/bench.html
[8]: http://code.google.com/p/libuevent/
[9]: https://github.com/kazuho/picoev
[LibuEV]: https://github.com/troglobit/libuev
[Oku Kazuho]: https://github.com/kazuho
[Mark Lehmann]: http://software.schmorp.de
[Travis]: https://travis-ci.org/troglobit/libuev
[Travis Status]: https://travis-ci.org/troglobit/libuev.png?branch=master
[Coverity Scan]: https://scan.coverity.com/projects/3846
[Coverity Status]: https://scan.coverity.com/projects/3846/badge.svg
[LibuEV]: https://github.com/troglobit/libuev
[Oku Kazuho]: https://github.com/kazuho
[Mark Lehmann]: http://software.schmorp.de
[Joachim Nilsson]: http://troglobit.com
[Flemming Madsen]: http://www.madsensoft.dk
[Dave Zarzycki, Apple]: http://www.youtube.com/watch?v=cD_s6Fjdri8
[libuEv] is developed and maintained by [Joachim Nilsson]
+52
View File
@@ -0,0 +1,52 @@
# libuEv examples
#
# Copyright (c) 2012 Flemming Madsen <flemming!madsen()madsensoft!dk>
# Copyright (c) 2013-2015 Joachim Nilsson <troglobit()gmail!com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
.PHONY: all clean
TARGET = joystick test
OBJS := $(addsuffix .o, $(TARGET))
SRCS := $(OBJS:.o=.c)
DEPS := $(SRCS:.c=.d)
CPPFLAGS += -I../
LDFLAGS := -L../
LDLIBS := ../$(STATICLIB)
# This magic trick looks like a comment, but works on BSD PMake
#include <../rules.mk>
include ../rules.mk
all: $(TARGET)
test: test.o
joystick: joystick.o
clean:
-@$(RM) $(TARGET) *.o
distclean: clean
-@$(RM) $(DEPS) $(JUNK)
# Include automatically generated rules
-include $(DEPS)
View File
+2 -2
View File
@@ -111,7 +111,7 @@ int main(void)
if (pipe(fd) < 0)
return 1;
/* */
/* Initialize libuEv */
uev_init(&ctx);
/* Signal watchers, Ctrl-C => SIGINT, Ctrl-\ => SIGQUIT */
@@ -141,7 +141,7 @@ int main(void)
fprintf(stderr, "Period is %d must be 10: %s\n", period, 10 == period ? "OK" : "ERROR!");
if (10 != period)
return 1;
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
# Pretty printing and GCC -M for auto dep files
%.o: %.c
@printf " CC $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
@$(CC) $(CFLAGS) $(CPPFLAGS) -c -MMD -MP -o $@ $<
%: %.o
@printf " LINK $(subst $(ROOTDIR)/,,$(shell pwd)/)$@\n"
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$@.map -o $@ $^ $(LDLIBS$(LDLIBS-$(@)))