tests/%: DIR=$(shell echo $@|sed -e 's,\([^/]*/[^/]*\)/.*,\1,')
tests/%:
- rm -rf $(DIR) && \
- mkdir -p $(DIR) && \
- cd $(DIR) && \
- sh ../../../$(DIR).files
+ rm -rf $(DIR)
+ mkdir -p $(DIR)
+ echo 'WVSTART() { if [ "$$WV" ]; then exit; else WV=1; fi; }; WVPASS() { :; }; needs_valid_CC() { :; }; omkize() { :; }' > $(DIR)/wvtest.sh
+ cd $(DIR) && ../../../$(DIR)
%.pdf: %.png
convert $< -density 150 $@
@subsection Header Files
C and C++ libraries are not very useful without header files. OMK
-provides several variables that controls operations with header files.
+provides several variables that control operations with header files.
During compilation, header files are copied (or linked by symbolic
links) from source directories to the @file{_compiled} tree (see
. ./wvtest.sh
-cat > 'Makefile.omk' <<EOF # This file is included into OMK manual
+cat > 'Makefile.omk' <<EOF # OMK manual includes this file - do not modify it
default_CONFIG = CONFIG_DEBUG=y CONFIG_SLOW=n
default_CONFIG += CONFIG_NUM=123 CONFIG_ARCH=arm
default_CONFIG += CONFIG_QUOTES="Text+quotes"
SUBDIRS=subdir
EOF
-cat > 'config.omk-correct' <<EOF
+cat > 'config.omk-correct' <<EOF # OMK manual includes this file
# Start of OMK config file
# This file should not be altered manually
# Overrides should be stored in file config.omk
CONFIG_ARCH=arm
CONFIG_QUOTES="Text+quotes"
EOF
-mkdir 'subdir'
-echo 'default_CONFIG = CONFIG_SUBDIR=y CONFIG_DEBUG=x' > 'subdir/Makefile.omk'
+
+mkdir subdir
+cat > 'subdir/Makefile.omk' <<EOF
+default_CONFIG = CONFIG_SUBDIR=y CONFIG_DEBUG=x
+EOF
+
omkize
WVPASS make
WVPASS diff -u config.omk-correct config.omk-default
int funca(int a);
int funcb(int b);
EOF
-cat > 'test.c' <<EOF
+cat > 'Makefile.omk' <<EOF # OMK manual includes this file - do not modify it
+lib_LIBRARIES = mylib
+mylib_SOURCES = funca.c funcb.c
+include_HEADERS = mylib.h
+EOF
+
+mkdir app
+cat > app/main.c <<EOF
#include <mylib.h>
int main() {
funca(10);
return 0;
}
EOF
-cat > 'Makefile.omk' <<EOF
-lib_LIBRARIES = mylib
-mylib_SOURCES = funca.c funcb.c
-include_HEADERS = mylib.h
-
-bin_PROGRAMS = test
-test_SOURCES = test.c
-test_LIBS = mylib
+cat > app/Makefile.omk <<EOF # OMK manual includes this file - do not modify it
+bin_PROGRAMS = libtest
+libtest_SOURCES = main.c
+libtest_LIBS = mylib
EOF
+
needs_valid_CC
WVPASS make
case $OMK_RULES in
linux) WVPASS test -f _compiled/lib/libmylib.a ;;
esac
+WVPASS make -C app
cat > 'test.c' <<'EOF'
int main() { return 0; }
EOF
-cat > 'Makefile.omk' <<'EOF'
+cat > 'Makefile.omk' <<'EOF' # OMK manual includes this file - do not modify it
bin_PROGRAMS = test
test_SOURCES = test.c
EOF