Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
a86e6ae9b0 | |||
2afdc3aada | |||
d3e158a717 | |||
1f93c2c86a | |||
7826c03ebc | |||
b75fc10cea | |||
2e529e785a | |||
b5d49ab82e | |||
35e6a0c428 | |||
45918377c7 | |||
a0cbdcb4c0 | |||
de0a1ee8e3 | |||
ab9afb258f | |||
25d63a2e48 | |||
92ca340c67 | |||
a2662cb960 | |||
e00a6acbd3 | |||
375ef49946 | |||
a79124b8d5 | |||
1d3ae53c60 | |||
a79535107d | |||
a5f07547c0 | |||
2bcac1eb7c | |||
dc06c4db9d | |||
b44a81085a | |||
965b125eb8 | |||
67e0f4b38f | |||
df68815cb5 | |||
f29338bf63 | |||
d185479478 | |||
414e1bc8df | |||
42ff4b9310 | |||
862158fcff | |||
59a462689e | |||
a59316af88 | |||
6ae7aae1e0 | |||
0837e19285 |
27
.github/workflows/deforaos-c-ci_ubuntu-latest.yml
vendored
Normal file
27
.github/workflows/deforaos-c-ci_ubuntu-latest.yml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
name: DeforaOS C CI (ubuntu-latest)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: bootstrap libSystem
|
||||
run: git clone https://github.com/DeforaOS/libSystem.git libSystem && for dir in include data src; do (cd libSystem/$dir && make PREFIX="$HOME/opt/DeforaOS" install); done
|
||||
- name: bootstrap configure
|
||||
run: git clone https://github.com/DeforaOS/configure.git configure && (cd configure/src && PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make PREFIX="$HOME/opt/DeforaOS" install)
|
||||
- name: configure
|
||||
run: $HOME/opt/DeforaOS/bin/configure -p "$HOME/opt/DeforaOS"
|
||||
- name: make
|
||||
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared"
|
||||
- name: make tests
|
||||
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared" tests
|
||||
- name: make distcheck
|
||||
run: PKG_CONFIG_PATH="$HOME/opt/DeforaOS/lib/pkgconfig" make CCSHARED="cc -shared" distcheck
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,5 +5,6 @@ Makefile
|
|||
*.so
|
||||
*.so.*
|
||||
*.so.*.*
|
||||
/config.ent
|
||||
/config.h
|
||||
/config.sh
|
||||
|
|
44
README.md
Normal file
44
README.md
Normal file
|
@ -0,0 +1,44 @@
|
|||
DeforaOS CPP
|
||||
============
|
||||
|
||||
About CPP
|
||||
---------
|
||||
|
||||
CPP is a macro preprocessor for the C programming language. It provides the
|
||||
ability for the inclusion of header files, macro expansions, conditional
|
||||
compilation, and line control.
|
||||
|
||||
CPP depends on the DeforaOS libSystem library (version 0.4.3 or above),
|
||||
which is found on the website for the DeforaOS Project:
|
||||
<https://www.defora.org/>.
|
||||
|
||||
|
||||
Compiling CPP
|
||||
-------------
|
||||
|
||||
CPP depends on the following components:
|
||||
|
||||
* DeforaOS libSystem
|
||||
* An implementation of `make`
|
||||
* GTK-Doc for the API documentation
|
||||
|
||||
With GCC, this should then be enough to compile and install CPP:
|
||||
|
||||
$ make install
|
||||
|
||||
To install CPP in a dedicated directory, like `/path/to/CPP`:
|
||||
|
||||
$ make PREFIX="/path/to/CPP" install
|
||||
|
||||
Distributing CPP
|
||||
----------------
|
||||
|
||||
DeforaOS CPP is subject to the terms of the GNU LGPL license (version 3).
|
||||
Please see the `COPYING` file for more information.
|
||||
|
||||
Known issues
|
||||
------------
|
||||
|
||||
* The cpp(1) binary may conflict with the system's own version.
|
||||
* Macro expansions are not fully supported yet.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2011-2014 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2011-2022 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -25,22 +25,120 @@
|
|||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/pkgconfig.sh}/../config.sh"
|
||||
PREFIX="/usr/local"
|
||||
[ -f "../config.sh" ] && . "../config.sh"
|
||||
DEBUG="_debug"
|
||||
DEVNULL="/dev/null"
|
||||
PROGNAME="pkgconfig.sh"
|
||||
#executables
|
||||
INSTALL="install -m 0644"
|
||||
DEBUG="_debug"
|
||||
INSTALL="install"
|
||||
MKDIR="mkdir -m 0755 -p"
|
||||
RM="rm -f"
|
||||
SED="sed"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#pkgconfig
|
||||
_pkgconfig()
|
||||
{
|
||||
#check the variables
|
||||
if [ -z "$PACKAGE" ]; then
|
||||
_error "The PACKAGE variable needs to be set"
|
||||
return $?
|
||||
fi
|
||||
if [ -z "$VERSION" ]; then
|
||||
_error "The VERSION variable needs to be set"
|
||||
return $?
|
||||
fi
|
||||
[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin"
|
||||
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||
[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include"
|
||||
[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib"
|
||||
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec"
|
||||
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
|
||||
[ -z "$SBINDIR" ] && SBINDIR="$PREFIX/sbin"
|
||||
if [ -z "$SYSCONFDIR" ]; then
|
||||
SYSCONFDIR="$PREFIX/etc"
|
||||
[ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc"
|
||||
fi
|
||||
PKGCONFIG="$PREFIX/lib/pkgconfig"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
shift
|
||||
|
||||
#clean
|
||||
[ "$clean" -ne 0 ] && continue
|
||||
|
||||
#uninstall
|
||||
if [ "$uninstall" -eq 1 ]; then
|
||||
$DEBUG $RM -- "$PKGCONFIG/$target" || return 2
|
||||
continue
|
||||
fi
|
||||
|
||||
#install
|
||||
if [ "$install" -eq 1 ]; then
|
||||
source="${target#$OBJDIR}"
|
||||
$DEBUG $MKDIR -- "$PKGCONFIG" || return 2
|
||||
mode="-m 0644"
|
||||
basename="$source"
|
||||
if [ "${source##*/}" != "$source" ]; then
|
||||
basename="${source##*/}"
|
||||
fi
|
||||
$DEBUG $INSTALL $mode "$target" "$PKGCONFIG/$basename" \
|
||||
|| return 2
|
||||
continue
|
||||
fi
|
||||
|
||||
#portability
|
||||
RPATH=
|
||||
if [ "$PREFIX" != "/usr" ]; then
|
||||
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
||||
case $(uname -s) in
|
||||
"Darwin")
|
||||
RPATH="-Wl,-rpath,\${libdir}"
|
||||
;;
|
||||
"SunOS")
|
||||
RPATH="-Wl,-R\${libdir}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#create
|
||||
source="${target#$OBJDIR}"
|
||||
source="${source}.in"
|
||||
([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") \
|
||||
|| return 2
|
||||
$DEBUG $SED -e "s;@VENDOR@;$VENDOR;g" \
|
||||
-e "s;@PACKAGE@;$PACKAGE;g" \
|
||||
-e "s;@VERSION@;$VERSION;g" \
|
||||
-e "s;@PREFIX@;$PREFIX;g" \
|
||||
-e "s;@BINDIR@;$BINDIR;g" \
|
||||
-e "s;@DATADIR@;$DATADIR;g" \
|
||||
-e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \
|
||||
-e "s;@LIBDIR@;$LIBDIR;g" \
|
||||
-e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \
|
||||
-e "s;@MANDIR@;$MANDIR;g" \
|
||||
-e "s;@PWD@;$PWD;g" \
|
||||
-e "s;@RPATH@;$RPATH;g" \
|
||||
-e "s;@SBINDIR@;$SBINDIR;g" \
|
||||
-e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \
|
||||
-- "$source" > "$target"
|
||||
if [ $? -ne 0 ]; then
|
||||
$RM -- "$target" 2> "$DEVNULL"
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
@ -48,7 +146,7 @@ _debug()
|
|||
#error
|
||||
_error()
|
||||
{
|
||||
echo "pkgconfig.sh: $@" 1>&2
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
@ -56,7 +154,7 @@ _error()
|
|||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: pkgconfig.sh [-c|-i|-u][-P prefix] target..." 1>&2
|
||||
echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -65,7 +163,7 @@ _usage()
|
|||
clean=0
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts "ciuP:" name; do
|
||||
while getopts "ciuO:P:" name; do
|
||||
case $name in
|
||||
c)
|
||||
clean=1
|
||||
|
@ -78,6 +176,9 @@ while getopts "ciuP:" name; do
|
|||
install=0
|
||||
uninstall=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
P)
|
||||
PREFIX="$OPTARG"
|
||||
;;
|
||||
|
@ -88,67 +189,10 @@ while getopts "ciuP:" name; do
|
|||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#check the variables
|
||||
if [ -z "$PACKAGE" ]; then
|
||||
_error "The PACKAGE variable needs to be set"
|
||||
exit $?
|
||||
fi
|
||||
if [ -z "$VERSION" ]; then
|
||||
_error "The VERSION variable needs to be set"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
PKGCONFIG="$PREFIX/lib/pkgconfig"
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
shift
|
||||
|
||||
#clean
|
||||
[ "$clean" -ne 0 ] && continue
|
||||
|
||||
#uninstall
|
||||
if [ "$uninstall" -eq 1 ]; then
|
||||
$DEBUG $RM -- "$PKGCONFIG/$target" || exit 2
|
||||
continue
|
||||
fi
|
||||
|
||||
#install
|
||||
if [ "$install" -eq 1 ]; then
|
||||
source="${target#$OBJDIR}"
|
||||
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2
|
||||
$DEBUG $INSTALL "$target" "$PKGCONFIG/$source" || exit 2
|
||||
continue
|
||||
fi
|
||||
|
||||
#portability
|
||||
RPATH=
|
||||
if [ "$PREFIX" != "/usr" ]; then
|
||||
RPATH="-Wl,-rpath-link,\${libdir} -Wl,-rpath,\${libdir}"
|
||||
case $(uname -s) in
|
||||
Darwin)
|
||||
RPATH="-Wl,-rpath,\${libdir}"
|
||||
;;
|
||||
SunOS)
|
||||
RPATH="-Wl,-R\${libdir}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#create
|
||||
source="${target#$OBJDIR}"
|
||||
source="${source}.in"
|
||||
$DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;" \
|
||||
-e "s;@VERSION@;$VERSION;" \
|
||||
-e "s;@PREFIX@;$PREFIX;" \
|
||||
-e "s;@RPATH@;$RPATH;" \
|
||||
-- "$source" > "$target"
|
||||
if [ $? -ne 0 ]; then
|
||||
$DEBUG $RM -- "$target"
|
||||
exit 2
|
||||
fi
|
||||
done
|
||||
exec 3>&1
|
||||
_pkgconfig "$@"
|
||||
|
|
5
doc/.gitignore
vendored
Normal file
5
doc/.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
/gtkdoc/html
|
||||
/gtkdoc/html.stamp
|
||||
/gtkdoc/CPP.types
|
||||
/gtkdoc/tmpl.stamp
|
||||
/gtkdoc/xml.stamp
|
157
doc/gtkdoc.sh
157
doc/gtkdoc.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2012-2015 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -25,6 +25,7 @@
|
|||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/gtkdoc.sh}/../config.sh"
|
||||
PREFIX="/usr/local"
|
||||
PROGNAME="gtkdoc.sh"
|
||||
#executables
|
||||
|
@ -38,16 +39,17 @@ GTKDOC_SCAN="gtkdoc-scan"
|
|||
INSTALL="install -m 0644"
|
||||
MKDIR="mkdir -m 0755 -p"
|
||||
RM="rm -f"
|
||||
RMDIR="rmdir"
|
||||
TOUCH="touch"
|
||||
|
||||
[ -f "../config.sh" ] && . "../config.sh"
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo "$@" 1>&2
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,77 @@ _error()
|
|||
}
|
||||
|
||||
|
||||
#gtkdoc_fixxref
|
||||
_gtkdoc_fixxref()
|
||||
{
|
||||
module="$1"
|
||||
moduledir="$2"
|
||||
htmldir="$3"
|
||||
outputdir="$4"
|
||||
|
||||
(cd "$outputdir" &&
|
||||
$DEBUG $GTKDOC_FIXXREF \
|
||||
--module="$module" \
|
||||
--module-dir="$moduledir" \
|
||||
--html-dir="$htmldir") || exit 2
|
||||
}
|
||||
|
||||
|
||||
#gtkdoc_mkdb
|
||||
_gtkdoc_mkdb()
|
||||
{
|
||||
module="$1"
|
||||
sourcedir="$2"
|
||||
outputdir="$3"
|
||||
|
||||
(cd "$sourcedir" &&
|
||||
$DEBUG $GTKDOC_MKDB --module="$module" \
|
||||
--output-dir="$outputdir" \
|
||||
--output-format="xml" --tmpl-dir="tmpl")
|
||||
}
|
||||
|
||||
|
||||
#gtkdoc_mkhtml
|
||||
_gtkdoc_mkhtml()
|
||||
{
|
||||
module="$1"
|
||||
path="$2"
|
||||
driver="$3"
|
||||
outputdir="$4"
|
||||
|
||||
(cd "$outputdir" &&
|
||||
$DEBUG $GTKDOC_MKHTML --path "$path" "$module" "$driver")
|
||||
}
|
||||
|
||||
|
||||
#gtkdoc_mktmpl
|
||||
_gtkdoc_mktmpl()
|
||||
{
|
||||
module="$1"
|
||||
sourcedir="$2"
|
||||
outputdir="$3"
|
||||
|
||||
(cd "$sourcedir" &&
|
||||
$DEBUG $GTKDOC_MKTMPL --module="$module" \
|
||||
--output-dir="$outputdir")
|
||||
}
|
||||
|
||||
|
||||
#gtkdoc_scan
|
||||
_gtkdoc_scan()
|
||||
{
|
||||
module="$1"
|
||||
sourcedir="$2"
|
||||
outputdir="$3"
|
||||
|
||||
(cd ".." &&
|
||||
$DEBUG $GTKDOC_SCAN --module="$module" \
|
||||
--source-dir="$sourcedir" \
|
||||
--output-dir="$outputdir")
|
||||
# --rebuild-types
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
|
@ -72,7 +145,7 @@ _usage()
|
|||
clean=0
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts "ciuP:" name; do
|
||||
while getopts "ciO:uP:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
|
@ -81,6 +154,9 @@ while getopts "ciuP:" name; do
|
|||
uninstall=0
|
||||
install=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
u)
|
||||
install=0
|
||||
uninstall=1
|
||||
|
@ -95,7 +171,7 @@ while getopts "ciuP:" name; do
|
|||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
@ -110,6 +186,7 @@ MODULE="$PACKAGE"
|
|||
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
|
||||
instdir="$DATADIR/gtk-doc/html"
|
||||
|
||||
exec 3>&1
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
target="${target#$OBJDIR}"
|
||||
|
@ -125,23 +202,28 @@ while [ $# -gt 0 ]; do
|
|||
file="${i##*/}"
|
||||
$DEBUG $RM -- "$instdir/$MODULE/$file" || exit 2
|
||||
done
|
||||
if [ -d "$instdir/$MODULE" ]; then
|
||||
$DEBUG $RMDIR -- "$instdir/$MODULE" || exit 2
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
#create
|
||||
case "$target" in
|
||||
gtkdoc/html.stamp)
|
||||
driver="../$MODULE-docs.xml"
|
||||
if [ -n "$OBJDIR" ]; then
|
||||
driver="gtkdoc/$MODULE-docs.xml"
|
||||
$DEBUG $CP -- "$driver" "${OBJDIR}gtkdoc" \
|
||||
|| exit 2
|
||||
fi
|
||||
output="${OBJDIR}gtkdoc/html"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
(cd "$output" &&
|
||||
$DEBUG $GTKDOC_MKHTML "$MODULE" \
|
||||
"${OBJDIR}$driver")
|
||||
driver="$MODULE-docs.xml"
|
||||
oldpath="$PWD"
|
||||
[ -n "$OBJDIR" ] && for file in \
|
||||
"gtkdoc/$driver" \
|
||||
"gtkdoc/xml/gtkdocentities.ent"; do
|
||||
[ -f "$file" ] || continue
|
||||
$DEBUG $CP -- "$file" \
|
||||
"${OBJDIR}$file" || exit 2
|
||||
done
|
||||
_gtkdoc_mkhtml "$MODULE" "${oldpath%/*}" "../$driver" \
|
||||
"$output"
|
||||
#detect when gtk-doc is not available
|
||||
res=$?
|
||||
if [ $res -eq 127 ]; then
|
||||
|
@ -152,24 +234,7 @@ while [ $# -gt 0 ]; do
|
|||
exit 2
|
||||
fi
|
||||
output="${OBJDIR}gtkdoc"
|
||||
(cd "$output" &&
|
||||
$DEBUG $GTKDOC_FIXXREF \
|
||||
--module="$MODULE" \
|
||||
--module-dir="html" \
|
||||
--html-dir="$instdir") || exit 2
|
||||
;;
|
||||
gtkdoc/sgml.stamp)
|
||||
output="xml"
|
||||
if [ -n "$OBJDIR" ]; then
|
||||
output="${OBJDIR}gtkdoc/xml"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
fi
|
||||
(cd "${OBJDIR}gtkdoc" &&
|
||||
$DEBUG $GTKDOC_MKDB \
|
||||
--module="$MODULE" \
|
||||
--output-dir="$output" \
|
||||
--output-format="xml" \
|
||||
--tmpl-dir="tmpl")
|
||||
_gtkdoc_fixxref "$MODULE" "html" "$instdir" "$output"
|
||||
;;
|
||||
gtkdoc/tmpl.stamp)
|
||||
output="tmpl"
|
||||
|
@ -177,22 +242,28 @@ while [ $# -gt 0 ]; do
|
|||
output="${OBJDIR}gtkdoc/tmpl"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
fi
|
||||
(cd "${OBJDIR}gtkdoc" &&
|
||||
$DEBUG $GTKDOC_MKTMPL \
|
||||
--module="$MODULE" \
|
||||
--output-dir="$output")
|
||||
_gtkdoc_mktmpl "$MODULE" "${OBJDIR}gtkdoc" "$output"
|
||||
;;
|
||||
gtkdoc/xml.stamp)
|
||||
output="xml"
|
||||
if [ -n "$OBJDIR" ]; then
|
||||
output="${OBJDIR}gtkdoc"
|
||||
sections="gtkdoc/$MODULE-sections.txt"
|
||||
$DEBUG $MKDIR -- "$output/xml" || exit 2
|
||||
$DEBUG $CP -- "$sections" "$output" \
|
||||
|| exit 2
|
||||
_gtkdoc_scan "$MODULE" "include" "$output"
|
||||
output="${OBJDIR}gtkdoc/xml"
|
||||
fi
|
||||
_gtkdoc_mkdb "$MODULE" "${OBJDIR}gtkdoc" "$output"
|
||||
;;
|
||||
gtkdoc/*.types)
|
||||
output="doc/gtkdoc" || exit 2
|
||||
output="$PWD/gtkdoc" || exit 2
|
||||
if [ -n "$OBJDIR" ]; then
|
||||
output="${OBJDIR}gtkdoc"
|
||||
$DEBUG $MKDIR -- "$output" || exit 2
|
||||
fi
|
||||
(cd ".." &&
|
||||
$DEBUG $GTKDOC_SCAN \
|
||||
--module="$MODULE" \
|
||||
--source-dir="include" \
|
||||
--output-dir="$output")
|
||||
_gtkdoc_scan "$MODULE" "include" "$output"
|
||||
;;
|
||||
*)
|
||||
_error "$target: Unknown type"
|
||||
|
@ -204,7 +275,7 @@ while [ $# -gt 0 ]; do
|
|||
_error "$target: Could not create documentation"
|
||||
install=0
|
||||
fi
|
||||
$TOUCH "$target"
|
||||
$TOUCH "${OBJDIR}$target"
|
||||
|
||||
#install
|
||||
if [ "$install" -eq 1 ]; then
|
||||
|
|
|
@ -3,25 +3,32 @@
|
|||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||
[
|
||||
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
||||
<!ENTITY server "www.defora.org/doc/gtk-doc/html">
|
||||
<!ENTITY title "DeforaOS CPP">
|
||||
<!ENTITY version "0.0.1">
|
||||
<!ENTITY % gtkdocentities SYSTEM "xml/gtkdocentities.ent">
|
||||
%gtkdocentities;
|
||||
<!ENTITY % configentities SYSTEM "config.ent">
|
||||
%configentities;
|
||||
]>
|
||||
<book id="index">
|
||||
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
|
||||
<bookinfo>
|
||||
<title>CPP Reference Manual</title>
|
||||
<title>&vendor; &package; &title;</title>
|
||||
<releaseinfo>
|
||||
for CPP &version;.
|
||||
for &vendor; &package; &version;.
|
||||
The latest version of this documentation can be found on-line at
|
||||
<ulink role="online-location" url="http://&server;/CPP/index.html">http://&server;/CPP/</ulink>.
|
||||
<ulink role="online-location" url="https://&server;/&package;/">https://&server;/&package;/</ulink>.
|
||||
</releaseinfo>
|
||||
</bookinfo>
|
||||
|
||||
<chapter>
|
||||
<title>&title;</title>
|
||||
<title>&vendor; &package;</title>
|
||||
<xi:include href="xml/CPP.xml"/>
|
||||
|
||||
</chapter>
|
||||
<!-- enable this when you use gobject types
|
||||
<chapter id="object-tree">
|
||||
<title>Object Hierarchy</title>
|
||||
<xi:include href="xml/tree_index.sgml"/>
|
||||
</chapter>
|
||||
-->
|
||||
<index id="api-index-full">
|
||||
<title>API Index</title>
|
||||
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||
|
@ -30,6 +37,7 @@
|
|||
<title>Index of deprecated API</title>
|
||||
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<!-- enable this when you use gobject introspection annotations
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
-->
|
||||
</book>
|
||||
|
|
21
doc/gtkdoc/CPP-sections.txt
Normal file
21
doc/gtkdoc/CPP-sections.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
<SECTION>
|
||||
<FILE>CPP</FILE>
|
||||
CPP_CODE_COUNT
|
||||
CPP_CODE_LAST
|
||||
CPP_CODE_META_FIRST
|
||||
CPP_CODE_META_LAST
|
||||
Cpp
|
||||
CppCode
|
||||
CppFilter
|
||||
CppOption
|
||||
cpp_define_add
|
||||
cpp_define_get
|
||||
cpp_define_remove
|
||||
cpp_delete
|
||||
cpp_get_filename
|
||||
cpp_new
|
||||
cpp_new_string
|
||||
cpp_path_add
|
||||
cpp_scan
|
||||
</SECTION>
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
subdirs=tmpl
|
||||
dist=Makefile,CPP-docs.xml
|
||||
dist=Makefile,CPP-docs.xml,CPP-sections.txt,xml/gtkdocentities.ent
|
||||
|
|
2
doc/gtkdoc/xml/gtkdocentities.ent
Normal file
2
doc/gtkdoc/xml/gtkdocentities.ent
Normal file
|
@ -0,0 +1,2 @@
|
|||
<!ENTITY server "www.defora.org/doc/gtk-doc/html">
|
||||
<!ENTITY title "Reference Manual">
|
|
@ -1,23 +1,25 @@
|
|||
subdirs=gtkdoc
|
||||
targets=gtkdoc/CPP.types,gtkdoc/tmpl.stamp,gtkdoc/sgml.stamp,gtkdoc/html.stamp
|
||||
targets=gtkdoc/CPP.types,gtkdoc/html.stamp,gtkdoc/tmpl.stamp,gtkdoc/xml.stamp
|
||||
dist=Makefile,gtkdoc.sh
|
||||
|
||||
#targets
|
||||
[gtkdoc/CPP.types]
|
||||
type=script
|
||||
script=./gtkdoc.sh
|
||||
|
||||
[gtkdoc/tmpl.stamp]
|
||||
type=script
|
||||
script=./gtkdoc.sh
|
||||
depends=$(OBJDIR)gtkdoc/CPP.types,gtkdoc/tmpl/cpp.sgml
|
||||
|
||||
[gtkdoc/sgml.stamp]
|
||||
type=script
|
||||
script=./gtkdoc.sh
|
||||
depends=$(OBJDIR)gtkdoc/tmpl.stamp
|
||||
depends=gtkdoc.sh
|
||||
|
||||
[gtkdoc/html.stamp]
|
||||
type=script
|
||||
script=./gtkdoc.sh
|
||||
depends=gtkdoc/CPP-docs.xml,$(OBJDIR)gtkdoc/sgml.stamp
|
||||
depends=gtkdoc/CPP-docs.xml,$(OBJDIR)gtkdoc/xml.stamp,gtkdoc/xml/gtkdocentities.ent,gtkdoc.sh,../config.ent,../config.sh
|
||||
install=
|
||||
|
||||
[gtkdoc/tmpl.stamp]
|
||||
type=script
|
||||
script=./gtkdoc.sh
|
||||
depends=$(OBJDIR)gtkdoc/CPP.types,gtkdoc.sh,../config.sh
|
||||
|
||||
[gtkdoc/xml.stamp]
|
||||
type=script
|
||||
script=./gtkdoc.sh
|
||||
depends=$(OBJDIR)gtkdoc/tmpl.stamp,gtkdoc.sh
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2008-2012 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2008-2015 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel cpp */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -126,6 +126,7 @@ typedef enum _CppCode
|
|||
|
||||
/* functions */
|
||||
Cpp * cpp_new(CppPrefs * prefs);
|
||||
Cpp * cpp_new_string(CppPrefs * prefs, char const * string);
|
||||
void cpp_delete(Cpp * cpp);
|
||||
|
||||
/* accessors */
|
||||
|
|
30
project.conf
30
project.conf
|
@ -1,6 +1,30 @@
|
|||
package=CPP
|
||||
version=0.0.2
|
||||
config=h,sh
|
||||
version=0.0.6
|
||||
vendor=Devel
|
||||
config=ent,h,sh
|
||||
|
||||
subdirs=data,doc,include,src,tests
|
||||
dist=Makefile,COPYING,config.h,config.sh
|
||||
targets=tests
|
||||
dist=Makefile,COPYING,README.md,config.ent,config.h,config.sh
|
||||
|
||||
#modes
|
||||
[mode::debug]
|
||||
title=Debug
|
||||
|
||||
[mode::release]
|
||||
title=Release
|
||||
|
||||
#targets
|
||||
[tests]
|
||||
type=command
|
||||
command=cd tests && (if [ -n "$(OBJDIR)" ]; then $(MAKE) OBJDIR="$(OBJDIR)tests/" "$(OBJDIR)tests/clint.log" "$(OBJDIR)tests/distcheck.log" "$(OBJDIR)tests/fixme.log"; else $(MAKE) clint.log distcheck.log fixme.log; fi)
|
||||
depends=all
|
||||
enabled=0
|
||||
phony=1
|
||||
|
||||
#dist
|
||||
[COPYING]
|
||||
install=$(PREFIX)/share/doc/$(PACKAGE)
|
||||
|
||||
[README.md]
|
||||
install=$(PREFIX)/share/doc/$(PACKAGE)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2006-2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2006-2022 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel cpp */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -72,6 +72,43 @@ Cpp * cpp_new(CppPrefs * prefs)
|
|||
}
|
||||
|
||||
|
||||
/* cpp_new_string */
|
||||
Cpp * cpp_new_string(CppPrefs * prefs, char const * string)
|
||||
{
|
||||
/* FIXME really implement */
|
||||
Cpp * cpp;
|
||||
String * p;
|
||||
int r = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
||||
#endif
|
||||
if((cpp = object_new(sizeof(*cpp))) == NULL)
|
||||
return NULL;
|
||||
memset(cpp, 0, sizeof(*cpp));
|
||||
cpp->options = prefs->options;
|
||||
cpp->parser = cppparser_new_string(cpp, NULL, string, prefs->filters);
|
||||
if((p = string_new(prefs->filename)) != NULL)
|
||||
{
|
||||
r |= cpp_path_add(cpp, dirname(p)); /* FIXME inclusion order */
|
||||
string_delete(p);
|
||||
}
|
||||
if((p = getcwd(NULL, 0)) != NULL)
|
||||
{
|
||||
r |= cpp_path_add(cpp, p);
|
||||
free(p);
|
||||
}
|
||||
else
|
||||
error_set("%s%s", "getcwd: ", strerror(errno));
|
||||
if(r != 0 || cpp->parser == NULL || cpp->paths_cnt != 2)
|
||||
{
|
||||
cpp_delete(cpp);
|
||||
return NULL;
|
||||
}
|
||||
return cpp;
|
||||
}
|
||||
|
||||
|
||||
/* cpp_delete */
|
||||
void cpp_delete(Cpp * cpp)
|
||||
{
|
|
@ -850,6 +850,7 @@ static int _cpp_callback_unknown(Parser * parser, Token * token, int c,
|
|||
CppParser * cppparser_new(Cpp * cpp, CppParser * parent, char const * filename,
|
||||
int filters)
|
||||
{
|
||||
/* FIXME factor code */
|
||||
CppParser * cp;
|
||||
|
||||
if((cp = object_new(sizeof(*cp))) == NULL)
|
||||
|
@ -901,6 +902,61 @@ CppParser * cppparser_new(Cpp * cpp, CppParser * parent, char const * filename,
|
|||
}
|
||||
|
||||
|
||||
/* cppparser_new_string */
|
||||
CppParser * cppparser_new_string(Cpp * cpp, CppParser * parent,
|
||||
char const * string, int filters)
|
||||
{
|
||||
CppParser * cp;
|
||||
|
||||
if((cp = object_new(sizeof(*cp))) == NULL)
|
||||
return NULL;
|
||||
cp->cpp = cpp;
|
||||
cp->parent = parent;
|
||||
cp->parser = parser_new_string(string, strlen(string));
|
||||
cp->filters = filters;
|
||||
cp->inject = NULL;
|
||||
cp->inject_first = 0;
|
||||
cp->newlines_last = 0;
|
||||
cp->newlines_last_cnt = 0;
|
||||
cp->trigraphs_last = 0;
|
||||
cp->trigraphs_last_cnt = 0;
|
||||
cp->directive_newline = 1;
|
||||
cp->directive_control = 0;
|
||||
cp->queue_ready = 0;
|
||||
cp->queue_code = CPP_CODE_NULL;
|
||||
cp->queue_string = NULL;
|
||||
cp->subparser = NULL;
|
||||
if(cp->parser == NULL)
|
||||
{
|
||||
cppparser_delete(cp);
|
||||
return NULL;
|
||||
}
|
||||
parser_add_filter(cp->parser, _cpp_filter_inject, cp);
|
||||
parser_add_filter(cp->parser, _cpp_filter_newlines, cp);
|
||||
if(cp->filters & CPP_FILTER_TRIGRAPH)
|
||||
parser_add_filter(cp->parser, _cpp_filter_trigraphs, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_inject, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_dequeue, cp);
|
||||
if(cp->filters & CPP_FILTER_WHITESPACE)
|
||||
parser_add_callback(cp->parser, _cpp_callback_whitespace, cp);
|
||||
else
|
||||
{
|
||||
parser_add_callback(cp->parser, _cpp_callback_newline, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_otherspace, cp);
|
||||
}
|
||||
parser_add_callback(cp->parser, _cpp_callback_comment, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_header, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_control, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_comma, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_operator, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_quote, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_directive, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_word, cp);
|
||||
parser_add_callback(cp->parser, _cpp_callback_unknown, cp);
|
||||
return cp;
|
||||
}
|
||||
|
||||
|
||||
/* cppparser_delete */
|
||||
void cppparser_delete(CppParser * cp)
|
||||
{
|
|
@ -28,6 +28,8 @@ typedef struct _CppParser CppParser;
|
|||
/* functions */
|
||||
CppParser * cppparser_new(Cpp * cpp, CppParser * parent, char const * filename,
|
||||
int filters);
|
||||
CppParser * cppparser_new_string(Cpp * cpp, CppParser * parent,
|
||||
char const * string, int filters);
|
||||
void cppparser_delete(CppParser * cppparser);
|
||||
|
||||
|
31
src/lib/project.conf
Normal file
31
src/lib/project.conf
Normal file
|
@ -0,0 +1,31 @@
|
|||
targets=libcpp
|
||||
cppflags_force=-I../../include
|
||||
cppflags=
|
||||
cflags_force=`pkg-config --cflags libSystem` -fPIC
|
||||
cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem`
|
||||
ldflags=
|
||||
dist=Makefile,common.h,parser.h
|
||||
|
||||
#modes
|
||||
[mode::debug]
|
||||
|
||||
[mode::release]
|
||||
cppflags_force=-I../../include -DNDEBUG
|
||||
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
|
||||
#targets
|
||||
[libcpp]
|
||||
type=library
|
||||
sources=cpp.c,parser.c,scanner.c
|
||||
install=$(LIBDIR)
|
||||
|
||||
#sources
|
||||
[cpp.c]
|
||||
depends=common.h,../../include/CPP.h
|
||||
|
||||
[parser.c]
|
||||
depends=parser.h,../../include/CPP.h
|
||||
|
||||
[scanner.c]
|
||||
depends=common.h,../../include/CPP.h
|
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2008-2013 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2008-2015 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel cpp */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
|
@ -362,7 +362,7 @@ static int _scan_define(Cpp * cpp, Token * token)
|
|||
if(cpp_define_add(cpp, var, val) != 0)
|
||||
{
|
||||
token_set_code(token, CPP_CODE_META_ERROR);
|
||||
token_set_string(token, error_get());
|
||||
token_set_string(token, error_get(NULL));
|
||||
}
|
||||
free(var);
|
||||
token_set_data(token, NULL);
|
||||
|
@ -375,7 +375,7 @@ static int _scan_include(Cpp * cpp, Token * token)
|
|||
if(cppparser_include(cpp->parser, token_get_data(token)) == 0)
|
||||
return 0;
|
||||
token_set_code(token, CPP_CODE_META_ERROR);
|
||||
token_set_string(token, error_get());
|
||||
token_set_string(token, error_get(NULL));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ static int _scan_undef(Cpp * cpp, Token * token)
|
|||
if(cpp_define_remove(cpp, var) != 0)
|
||||
{
|
||||
token_set_code(token, CPP_CODE_META_ERROR);
|
||||
token_set_string(token, error_get());
|
||||
token_set_string(token, error_get(NULL));
|
||||
}
|
||||
free(var);
|
||||
free(str);
|
24
src/main.c
24
src/main.c
|
@ -1,5 +1,5 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2007-2013 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2007-2022 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel cpp */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -24,6 +24,10 @@
|
|||
#include <errno.h>
|
||||
#include "CPP.h"
|
||||
|
||||
#ifndef PROGNAME_CPP
|
||||
# define PROGNAME_CPP "cpp"
|
||||
#endif
|
||||
|
||||
|
||||
/* cpp */
|
||||
/* private */
|
||||
|
@ -62,13 +66,13 @@ static int _cpp(Prefs * prefs, int filec, char * filev[])
|
|||
if(prefs->outfile == NULL)
|
||||
fp = stdout;
|
||||
else if((fp = fopen(prefs->outfile, "w")) == NULL)
|
||||
return error_set_print("cpp", 1, "%s: %s", prefs->outfile,
|
||||
strerror(errno));
|
||||
return error_set_print(PROGNAME_CPP, 1, "%s: %s",
|
||||
prefs->outfile, strerror(errno));
|
||||
for(i = 0; i < filec; i++)
|
||||
ret |= _cpp_do(prefs, fp, filev[i]);
|
||||
if(fclose(fp) != 0)
|
||||
return error_set_print("cpp", 1, "%s: %s", prefs->outfile,
|
||||
strerror(errno));
|
||||
return error_set_print(PROGNAME_CPP, 1, "%s: %s",
|
||||
prefs->outfile, strerror(errno));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -143,7 +147,7 @@ static void _do_print_token(FILE * fp, Token * token)
|
|||
/* cpp_error */
|
||||
static int _cpp_error(void)
|
||||
{
|
||||
return error_print("cpp");
|
||||
return error_print(PROGNAME_CPP);
|
||||
}
|
||||
|
||||
|
||||
|
@ -151,7 +155,7 @@ static int _cpp_error(void)
|
|||
/* FIXME -E prints metadata? */
|
||||
static int _usage(void)
|
||||
{
|
||||
fputs("Usage: cpp [-D name[=value]]...[-I directory][-o file][-t][-U name]... input...\n"
|
||||
fputs("Usage: " PROGNAME_CPP " [-D name[=value]]...[-I directory][-o file][-t][-U name]... input...\n"
|
||||
" -D Add a substitution\n"
|
||||
" -I Add a directory to the search path\n"
|
||||
" -o Write output to a file\n"
|
||||
|
@ -218,7 +222,7 @@ static int _main_add_define(Prefs * prefs, char * define)
|
|||
value = strtok(define, "=");
|
||||
if((p = realloc(prefs->defines, sizeof(*p) * (prefs->defines_cnt + 1)))
|
||||
== NULL)
|
||||
return error_set_print("cpp", 1, "%s", strerror(errno));
|
||||
return error_set_print(PROGNAME_CPP, 1, "%s", strerror(errno));
|
||||
prefs->defines = p;
|
||||
prefs->defines[prefs->defines_cnt++] = define;
|
||||
return 0;
|
||||
|
@ -230,7 +234,7 @@ static int _main_add_path(Prefs * prefs, char const * path)
|
|||
|
||||
if((p = realloc(prefs->paths, sizeof(*p) * (prefs->paths_cnt + 1)))
|
||||
== NULL)
|
||||
return error_set_print("cpp", 1, "%s", strerror(errno));
|
||||
return error_set_print(PROGNAME_CPP, 1, "%s", strerror(errno));
|
||||
prefs->paths = p;
|
||||
prefs->paths[prefs->paths_cnt++] = path;
|
||||
return 0;
|
||||
|
@ -244,7 +248,7 @@ static int _main_add_undefine(Prefs * prefs, char const * undefine)
|
|||
return 1;
|
||||
if((p = realloc(prefs->undefines, sizeof(*p)
|
||||
* (prefs->undefines_cnt + 1))) == NULL)
|
||||
return error_set_print("cpp", 1, "%s", strerror(errno));
|
||||
return error_set_print(PROGNAME_CPP, 1, "%s", strerror(errno));
|
||||
prefs->undefines = p;
|
||||
prefs->undefines[prefs->undefines_cnt++] = undefine;
|
||||
return 0;
|
||||
|
|
|
@ -1,34 +1,30 @@
|
|||
targets=libcpp,cpp
|
||||
subdirs=lib
|
||||
targets=cpp
|
||||
cppflags_force=-I ../include
|
||||
cppflags=
|
||||
cflags_force=`pkg-config --cflags libSystem`
|
||||
cflags=-W -Wall -g -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector-all
|
||||
cflags_force=`pkg-config --cflags libSystem` -fPIE
|
||||
cflags=-W -Wall -g -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs libSystem`
|
||||
ldflags=
|
||||
dist=Makefile,common.h,parser.h
|
||||
ldflags=-pie -Wl,-z,relro -Wl,-z,now
|
||||
dist=Makefile
|
||||
|
||||
[libcpp]
|
||||
type=library
|
||||
sources=cpp.c,parser.c,scanner.c
|
||||
cflags=-fPIC
|
||||
install=$(LIBDIR)
|
||||
#modes
|
||||
[mode::debug]
|
||||
|
||||
[cpp.c]
|
||||
depends=common.h,../include/CPP.h
|
||||
|
||||
[parser.c]
|
||||
depends=parser.h,../include/CPP.h
|
||||
|
||||
[scanner.c]
|
||||
depends=common.h,../include/CPP.h
|
||||
[mode::release]
|
||||
cppflags_force=-I ../include -DNDEBUG
|
||||
cflags=-W -Wall -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
|
||||
#targets
|
||||
[cpp]
|
||||
type=binary
|
||||
sources=main.c
|
||||
depends=$(OBJDIR)libcpp.so
|
||||
cflags=-fPIE
|
||||
ldflags=-L$(OBJDIR). -L$(LIBDIR) -Wl,-rpath,$(LIBDIR) -lcpp
|
||||
#XXX should really use this (race condition with "make -k")
|
||||
depends=$(OBJDIR)lib/libcpp$(SOEXT)
|
||||
depends=$(OBJDIR)lib/libcpp.a
|
||||
ldflags=-L$(OBJDIR)lib -L$(LIBDIR) -Wl,-rpath,$(LIBDIR) -lcpp
|
||||
install=$(BINDIR)
|
||||
|
||||
#sources
|
||||
[main.c]
|
||||
depends=../include/CPP.h
|
||||
|
|
3
tests/.gitignore
vendored
Normal file
3
tests/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/clint.log
|
||||
/distcheck.log
|
||||
/fixme.log
|
192
tests/clint.sh
Executable file
192
tests/clint.sh
Executable file
|
@ -0,0 +1,192 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2016-2021 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/clint.sh}/../config.sh"
|
||||
CFLAGS=
|
||||
CPPFLAGS=
|
||||
PROGNAME="clint.sh"
|
||||
PROJECTCONF="../project.conf"
|
||||
#executables
|
||||
DATE="date"
|
||||
DEBUG="_debug"
|
||||
ECHO="/bin/echo"
|
||||
FIND="find"
|
||||
GREP="grep"
|
||||
LINT="lint -g"
|
||||
MKDIR="mkdir -p"
|
||||
SORT="sort -n"
|
||||
TR="tr"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#clint
|
||||
_clint()
|
||||
{
|
||||
res=0
|
||||
subdirs=
|
||||
|
||||
$DATE
|
||||
while read line; do
|
||||
case "$line" in
|
||||
"["*)
|
||||
break
|
||||
;;
|
||||
"subdirs="*)
|
||||
subdirs=${line#subdirs=}
|
||||
subdirs=$(echo "$subdirs" | $TR ',' ' ')
|
||||
;;
|
||||
esac
|
||||
done < "$PROJECTCONF"
|
||||
if [ ! -n "$subdirs" ]; then
|
||||
_error "Could not locate directories to analyze"
|
||||
return $?
|
||||
fi
|
||||
for subdir in $subdirs; do
|
||||
[ -d "../$subdir" ] || continue
|
||||
while read filename; do
|
||||
[ -n "$filename" ] || continue
|
||||
r=0
|
||||
case "$filename" in
|
||||
*.c)
|
||||
echo
|
||||
_clint_lint "$filename" || r=$?
|
||||
_clint_rtrim "$filename"|| r=$?
|
||||
;;
|
||||
*.h)
|
||||
echo
|
||||
echo "$filename:"
|
||||
_clint_rtrim "$filename"|| r=$?
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if [ $r -eq 0 ]; then
|
||||
echo " OK"
|
||||
echo "$PROGNAME: $filename: OK" 1>&2
|
||||
else
|
||||
echo "FAIL"
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
res=2
|
||||
fi
|
||||
done << EOF
|
||||
$($FIND "../$subdir" -type f | $SORT)
|
||||
EOF
|
||||
done
|
||||
return $res
|
||||
}
|
||||
|
||||
_clint_lint()
|
||||
{(
|
||||
filename="$1"
|
||||
|
||||
$ECHO -n "${filename%/*}/"
|
||||
$DEBUG $LINT $CPPFLAGS $CFLAGS "$filename" 2>&1
|
||||
ret=$?
|
||||
if [ $ret -eq 127 ]; then
|
||||
#XXX ignore errors when $LINT is not available
|
||||
ret=0
|
||||
fi
|
||||
return $ret
|
||||
)}
|
||||
|
||||
_clint_rtrim()
|
||||
{
|
||||
filename="$1"
|
||||
regex="[ ]\\+\$"
|
||||
|
||||
$DEBUG $GREP -vq "$regex" "$filename" 2>&1
|
||||
}
|
||||
|
||||
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: $PROGNAME [-c] target..." 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cO:P:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
P)
|
||||
CPPFLAGS="$CPPFLAGS -I$OPTARG/include"
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#clean
|
||||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_clint > "$target" || ret=$?
|
||||
done
|
||||
exit $ret
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2013-2014 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2013-2022 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -27,8 +27,7 @@
|
|||
#variables
|
||||
PROGNAME="cpp.sh"
|
||||
#executables
|
||||
CPP="../src/cpp"
|
||||
[ -n "$OBJDIR" ] && CPP="${OBJDIR}../src/cpp"
|
||||
CPP="$OBJDIR../src/cpp"
|
||||
|
||||
|
||||
#functions
|
||||
|
@ -64,14 +63,14 @@ fi
|
|||
if [ $# -eq 1 -a -n "$output" ]; then
|
||||
target="$1"
|
||||
|
||||
LD_LIBRARY_PATH="../src" $CPP "$target" > "$output"
|
||||
LD_LIBRARY_PATH="$OBJDIR../src/lib" $CPP "$target" > "$output"
|
||||
elif [ $# -ge 1 -a -z "$output" ]; then
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
output="${target%.cpp}.o"
|
||||
shift
|
||||
|
||||
LD_LIBRARY_PATH="../src" $CPP "$target" > "$output"
|
||||
LD_LIBRARY_PATH="$OBJDIR../src/lib" $CPP "$target" > "$output"
|
||||
done
|
||||
else
|
||||
_usage
|
||||
|
|
102
tests/distcheck.sh
Executable file
102
tests/distcheck.sh
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2020 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/distcheck.sh}/../config.sh"
|
||||
CFLAGS=
|
||||
LDFLAGS=
|
||||
PROGNAME="distcheck.sh"
|
||||
TARGET="tests.log"
|
||||
#executables
|
||||
DATE="date"
|
||||
[ -n "$MAKE" ] || MAKE="make"
|
||||
MKDIR="mkdir -p"
|
||||
MKTEMP="mktemp"
|
||||
RM="rm -f"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#distcheck
|
||||
_distcheck()
|
||||
{
|
||||
(cd .. && $MAKE distcheck)
|
||||
}
|
||||
|
||||
|
||||
#date
|
||||
_date()
|
||||
{
|
||||
if [ -n "$SOURCE_DATE_EPOCH" ]; then
|
||||
TZ=UTC $DATE -d "@$SOURCE_DATE_EPOCH" '+%a %b %d %T %Z %Y'
|
||||
else
|
||||
$DATE
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: $PROGNAME [-c] target..." 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cO:P:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
P)
|
||||
#XXX ignored
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
while [ $# -ne 0 ]; do
|
||||
target="$1"
|
||||
shift
|
||||
|
||||
[ "$clean" -eq 0 ] || break
|
||||
|
||||
(_date; echo; _distcheck) > "$target" || exit 2
|
||||
done
|
||||
exit 0
|
261
tests/fixme.sh
Executable file
261
tests/fixme.sh
Executable file
|
@ -0,0 +1,261 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2017-2022 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/fixme.sh}/../config.sh"
|
||||
PROGNAME="fixme.sh"
|
||||
PROJECTCONF="../project.conf"
|
||||
REGEXP_ERROR="FIXME"
|
||||
REGEXP_WARNING="\\(TODO\|XXX\\)"
|
||||
#executables
|
||||
DATE="date"
|
||||
DEBUG="_debug"
|
||||
FIND="find"
|
||||
GREP="grep"
|
||||
HEAD="head"
|
||||
MKDIR="mkdir -p"
|
||||
SORT="sort -n"
|
||||
TR="tr"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#fixme
|
||||
_fixme()
|
||||
{
|
||||
res=0
|
||||
subdirs=
|
||||
|
||||
$DATE
|
||||
echo
|
||||
while read line; do
|
||||
case "$line" in
|
||||
"["*)
|
||||
break
|
||||
;;
|
||||
"subdirs="*)
|
||||
subdirs=${line#subdirs=}
|
||||
subdirs=$(echo "$subdirs" | $TR ',' ' ')
|
||||
;;
|
||||
esac
|
||||
done < "$PROJECTCONF"
|
||||
if [ ! -n "$subdirs" ]; then
|
||||
_error "Could not locate directories to analyze"
|
||||
return $?
|
||||
fi
|
||||
for subdir in $subdirs; do
|
||||
[ -d "../$subdir" ] || continue
|
||||
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
||||
callback=$(_fixme_callback "$filename")
|
||||
[ -n "$callback" ] || continue
|
||||
($callback "$filename") 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
res=2
|
||||
fi
|
||||
done
|
||||
done
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_callback()
|
||||
{
|
||||
filename="$1"
|
||||
ext=${filename##*/}
|
||||
ext=${ext%.in}
|
||||
ext=${ext##*.}
|
||||
callback=
|
||||
|
||||
case "$ext" in
|
||||
asm|S)
|
||||
echo "_fixme_callback_asm"
|
||||
return 0
|
||||
;;
|
||||
c|cc|cpp|cxx|go|h|js|v)
|
||||
echo "_fixme_callback_c"
|
||||
return 0
|
||||
;;
|
||||
conf|sh)
|
||||
echo "_fixme_callback_sh"
|
||||
return 0
|
||||
;;
|
||||
py)
|
||||
echo "_fixme_callback_python"
|
||||
return 0
|
||||
;;
|
||||
htm|html|xml|xsl)
|
||||
echo "_fixme_callback_xml"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
case $($HEAD -n 1 "$filename") in
|
||||
"#!/bin/sh"*|"#! /bin/sh"*|\
|
||||
"#!/usr/bin/env bash"*|"#! /usr/bin/env bash"*)
|
||||
echo "_fixme_callback_sh"
|
||||
return 0
|
||||
;;
|
||||
"#!/usr/bin/env python"*|"#! /usr/bin/env python"*)
|
||||
echo "_fixme_callback_python"
|
||||
return 0
|
||||
;;
|
||||
"<!DOCTYPE"*|"<!doctype"*|"<HTML"*|"<html"*|"<?xml"*)
|
||||
echo "_fixme_callback_xml"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
return 2
|
||||
}
|
||||
|
||||
_fixme_callback_asm()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
|
||||
#warnings
|
||||
$GREP -nH "/\\*.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH "/\\*.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_callback_c()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
|
||||
#warnings
|
||||
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_callback_python()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
comment="#"
|
||||
|
||||
#warnings
|
||||
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_callback_sh()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
comment="#"
|
||||
|
||||
#warnings
|
||||
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_callback_xml()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
|
||||
#XXX limited to a single line
|
||||
#warnings
|
||||
$GREP -nH "<!--.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH "<!--.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
#debug
|
||||
_debug()
|
||||
{
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: $PROGNAME [-c] target..." 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cO:P:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
P)
|
||||
#XXX ignored for compatibility
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
#clean
|
||||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_fixme > "$target" || ret=$?
|
||||
done
|
||||
exit $ret
|
|
@ -1,28 +1,49 @@
|
|||
targets=define.o,if.o,include.o
|
||||
targets=clint.log,define.o,distcheck.log,fixme.log,if.o,include.o
|
||||
cxx=./cpp.sh
|
||||
cxxflags=
|
||||
dist=Makefile,cpp.sh,include-define.cpp
|
||||
dist=Makefile,clint.sh,cpp.sh,distcheck.sh,fixme.sh,include-define.cpp
|
||||
|
||||
#targets
|
||||
[clint.log]
|
||||
type=script
|
||||
script=./clint.sh
|
||||
flags=-O CPPFLAGS="-I../include"
|
||||
depends=clint.sh
|
||||
enabled=0
|
||||
|
||||
[define.o]
|
||||
type=object
|
||||
sources=define.cpp
|
||||
depends=../src/cpp
|
||||
|
||||
[define.cpp]
|
||||
depends=cpp.sh
|
||||
[distcheck.log]
|
||||
type=script
|
||||
script=./distcheck.sh
|
||||
depends=distcheck.sh
|
||||
enabled=0
|
||||
|
||||
[fixme.log]
|
||||
type=script
|
||||
script=./fixme.sh
|
||||
depends=fixme.sh
|
||||
enabled=0
|
||||
|
||||
[if.o]
|
||||
type=object
|
||||
sources=if.cpp
|
||||
depends=../src/cpp
|
||||
|
||||
[if.cpp]
|
||||
depends=cpp.sh
|
||||
|
||||
[include.o]
|
||||
type=object
|
||||
sources=include.cpp
|
||||
depends=../src/cpp
|
||||
|
||||
#sources
|
||||
[define.cpp]
|
||||
depends=cpp.sh
|
||||
|
||||
[if.cpp]
|
||||
depends=cpp.sh
|
||||
|
||||
[include.cpp]
|
||||
depends=cpp.sh
|
||||
|
|
Loading…
Reference in New Issue
Block a user