mirror of
https://github.com/cesanta/slre.git
synced 2025-03-13 17:05:31 +00:00
Merge 68611c0595
into 901d42c33a
This commit is contained in:
commit
201454be11
33
.gitignore
vendored
Normal file
33
.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Object files
|
||||||
|
*.o
|
||||||
|
*.ko
|
||||||
|
*.obj
|
||||||
|
*.elf
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
*.lib
|
||||||
|
*.a
|
||||||
|
*.la
|
||||||
|
*.lo
|
||||||
|
|
||||||
|
# Shared objects (inc. Windows DLLs)
|
||||||
|
*.dll
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*.dylib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
*.i*86
|
||||||
|
*.x86_64
|
||||||
|
*.hex
|
||||||
|
*.bin
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
57
Makefile
Normal file
57
Makefile
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# #
|
||||||
|
# This Makefile builds the Unit test executable and the #
|
||||||
|
# shared library: libslre.so #
|
||||||
|
# #
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
|
||||||
|
libname=libslre.so
|
||||||
|
unit_test=unit_test.bin
|
||||||
|
unit_test_shared=unit_test_shared.bin
|
||||||
|
|
||||||
|
all: $(unit_test) $(libname) $(unit_test_shared)
|
||||||
|
|
||||||
|
|
||||||
|
# Unit test compiled without shared library
|
||||||
|
#
|
||||||
|
$(unit_test):
|
||||||
|
$(CC) -c slre.c
|
||||||
|
$(CC) -c unit_test.c
|
||||||
|
$(CC) -o unit_test.bin slre.o unit_test.o
|
||||||
|
@echo "Done. OK! run $ make test"
|
||||||
|
|
||||||
|
# Unit Test compiled with shared library
|
||||||
|
#
|
||||||
|
$(unit_test_shared): $(libname)
|
||||||
|
gcc -c unit_test.c
|
||||||
|
gcc -L$(shell pwd) -Wall -o unit_test_shared.bin unit_test.o -lslre
|
||||||
|
|
||||||
|
# Build shared library
|
||||||
|
#
|
||||||
|
$(libname):
|
||||||
|
$(CC) -fPIC -g -c slre.c
|
||||||
|
$(CC) -shared -Wl,-soname,$(libname) -o $(libname) slre.o -lc
|
||||||
|
|
||||||
|
tests: $(unit_test) $(unit_test_shared)
|
||||||
|
bash unit_test.sh
|
||||||
|
|
||||||
|
|
||||||
|
install: $(libname)
|
||||||
|
cp $(shell pwd)/slre.h /usr/include/slre.h
|
||||||
|
cp $(shell pwd)/$(libname) /usr/lib/$(libname)
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -rf /usr/include/slre.h
|
||||||
|
rm -rf /usr/lib/$(lib)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -rf *.o *.bin *.out *.so
|
||||||
|
|
||||||
|
|
21
unit_test.sh
Executable file
21
unit_test.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Test library
|
||||||
|
#
|
||||||
|
#--------------------------
|
||||||
|
echo "Running Unit test"
|
||||||
|
echo ""
|
||||||
|
./unit_test.bin
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Test shared library Wrapper
|
||||||
|
#
|
||||||
|
export LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
echo "Running Shared Library Unit Test"
|
||||||
|
echo ""
|
||||||
|
./unit_test_shared.bin
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
|
Loading…
Reference in New Issue
Block a user