source: mainline/uspace/lib/pcut/unix.mak@ 01579ad

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 01579ad was 01579ad, checked in by Vojtech Horky <vojtechhorky@…>, 11 years ago

Start work on PCUT integration

PCUT is a simple library for (hopefully) easier unit testing.
See https://github.com/vhotspur/pcut for more details.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1#
2# Copyright (c) 2013 Vojtech Horky
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29PCUT_TARGET_SOURCES = src/os/stdc.c src/os/unix.c
30OBJ_EXT = o
31PCUT_LIB = libpcut.a
32
33# Installation paths
34PREFIX = /usr/local
35LIBDIR = $(PREFIX)/lib
36INCLUDEDIR = $(PREFIX)/include
37
38-include pcut.mak
39
40PCUT_OBJECTS := $(addsuffix .o,$(basename $(PCUT_SOURCES)))
41
42# Take care of dependencies
43DEPEND = Makefile.depend
44-include $(DEPEND)
45$(DEPEND):
46 makedepend -f - -Iinclude -- $(PCUT_SOURCES) >$@ 2>/dev/null
47
48
49#
50# Add the check target for running all the tests
51#
52TEST_BASE = tests/
53EXE_EXT = run
54TEST_CFLAGS = $(PCUT_CFLAGS)
55TEST_LDFLAGS = -L. -lpcut
56-include tests/tests.mak
57TEST_APPS_BASENAMES := $(basename $(TEST_APPS))
58DIFF = diff
59DIFFFLAGS = -du1
60
61check: libpcut.a check-build
62 @for i in $(TEST_APPS_BASENAMES); do \
63 echo -n ./$$i; \
64 ./$$i.$(EXE_EXT) | sed 's:$(TEST_BASE)::g' >$$i.got; \
65 if cmp -s $$i.got $$i.expected; then \
66 echo " ok."; \
67 else \
68 echo " failed:"; \
69 $(DIFF) $(DIFFFLAGS) $$i.expected $$i.got; \
70 fi; \
71 done
72
73#
74# Clean-up
75#
76platform-clean:
77 rm -f libpcut.a $(DEPEND)
78
79#
80# Actual build rules
81#
82$(PCUT_LIB): $(PCUT_OBJECTS)
83 $(AR) rc $@ $(PCUT_OBJECTS)
84 $(RANLIB) $@
85
86%.o: $(DEPEND)
87
88#
89# Installation
90#
91install: $(PCUT_LIB)
92 install -d -m 755 $(DESTDIR)$(LIBDIR)
93 install -d -m 755 $(DESTDIR)$(INCLUDEDIR)/pcut
94 install -m 644 $(PCUT_LIB) $(DESTDIR)$(LIBDIR)/$(PCUT_LIB)
95 install -m 644 include/pcut/*.h $(DESTDIR)$(INCLUDEDIR)/pcut/
Note: See TracBrowser for help on using the repository browser.