Skip to content

Commit 2f33da5

Browse files
committed
Add pkgconfig-based build scripting
1 parent 651ccd8 commit 2f33da5

File tree

7 files changed

+119
-16
lines changed

7 files changed

+119
-16
lines changed

Makefile

-9
This file was deleted.

Makefile.in

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
SHELL = /bin/sh
2+
CFLAGS = -g -Wall -pedantic -std=c99
3+
4+
prefix = @prefix@
5+
exec_prefix = $(prefix)
6+
bindir = $(exec_prefix)/bin
7+
libdir = $(exec_prefix)/lib
8+
datarootdir = $(prefix)/share
9+
mandir = $(datarootdir)/man
10+
includedir = $(prefix)/include
11+
12+
PROG = crbehave
13+
OBJS = crbehave.o
14+
15+
INSTALL = install
16+
INSTALLFLAGS =
17+
18+
all: $(PROG).a
19+
20+
$(PROG).a: $(OBJS)
21+
ar r $(PROG).a $(OBJS)
22+
23+
.c.o:
24+
$(CC) -c $(CFLAGS) $<
25+
26+
clean:
27+
rm -f $(OBJS) $(PROG).a
28+
29+
install: $(PROG).a
30+
if [ ! -x $(DESTDIR)$(libdir) ] ; then \
31+
mkdir -p $(DESTDIR)$(libdir) ; fi
32+
if [ ! -x $(DESTDIR)$(libdir)/pkgconfig ] ; then \
33+
mkdir -p $(DESTDIR)$(libdir)/pkgconfig ; fi
34+
if [ ! -x $(DESTDIR)$(includedir) ] ; then \
35+
mkdir -p $(DESTDIR)$(includedir) ; fi
36+
$(INSTALL) $(INSTALLFLAGS) $(PROG).a $(DESTDIR)$(libdir)
37+
cp crbehave.pc $(DESTDIR)$(libdir)/pkgconfig
38+
cp crbehave.h $(DESTDIR)$(includedir)
39+
40+
uninstall:
41+
if [ -e $(DESTDIR)$(libdir)/$(PROG).a ] ; then \
42+
rm $(DESTDIR)$(libdir)/$(PROG).a ; fi
43+
if [ -e $(DESTDIR)$(libdir)/pkgconfig/$(PROG).pc ] ; then \
44+
rm $(DESTDIR)$(libdir)/pkgconfig/$(PROG).pc ; fi
45+
if [ -e $(includedir)/crbehave.h ] ; then \
46+
rm $(DESTDIR)$(includedir)/crbehave.h ; fi

configure

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
# Usage: ./configure [install prefix]
3+
4+
prefix=/usr/local
5+
PROG=crbehave
6+
7+
if [ "$#" -eq 1 ] ; then prefix=$1 ; fi
8+
echo "prefix=${prefix}"
9+
10+
echo "create: ${PROG}.pc"
11+
sed "s|@prefix@|${prefix}|g" ${PROG}.pc.in >${PROG}.pc
12+
echo "create: Makefile"
13+
sed "s|@prefix@|${prefix}|g" Makefile.in >Makefile

crbehave.pc.in

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@prefix@
2+
exec_prefix=${prefix}
3+
libdir=${exec_prefix}/lib
4+
includedir=${prefix}/include
5+
6+
Name: crbehave
7+
Description: Regex based behavior driven testing framework for C
8+
Version: 0.1
9+
Libs: ${libdir}/crbehave.a
10+
Cflags: -I${includedir}

examples/Makefile

-7
This file was deleted.

examples/Makefile.in

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
CRBEHAVE_CFLAGS = @CRBEHAVE_CFLAGS@
2+
CRBEHAVE_LDFLAGS = @CRBEHAVE_LDFLAGS@
3+
PROG = tuples
4+
CFLAGS = $(CRBEHAVE_CFLAGS) -Wall -pedantic -std=c99
5+
LDFLAGS = $(CRBEHAVE_LDFLAGS)
6+
7+
all: $(PROG)
8+
9+
SRCS=tuple.c tuples.c
10+
OBJS=$(SRCS:.c=.o)
11+
12+
$(PROG): $(OBJS)
13+
$(CC) -o$@ $(OBJS) $(LDFLAGS)
14+
15+
.c.o:
16+
$(CC) $(CFLAGS) -c $<
17+
18+
clean:
19+
rm -f $(PROG) $(OBJS)

examples/configure

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
# Usage: ./configure [install prefix]
3+
4+
which pkg-config >/dev/null
5+
if [ "$?" -ne 0 ] ; then
6+
echo "You need to have pkg-config installed and in PATH."
7+
exit 1
8+
fi
9+
10+
prefix=/usr/local
11+
if [ "$#" -eq 1 ] ; then prefix=$1 ; fi
12+
echo "prefix=${prefix}"
13+
14+
echo "check: crbehave"
15+
pkg-config crbehave
16+
if [ "$?" -ne 0 ] ; then
17+
echo "You need to have 'crbehave' pkg-config package installed."
18+
echo "Verify also your PKG_CONFIG_PATH."
19+
exit 1
20+
fi
21+
CRBEHAVE_CFLAGS=$(pkg-config crbehave --cflags)
22+
echo "CRBEHAVE_CFLAGS=${CRBEHAVE_CFLAGS}"
23+
CRBEHAVE_LDFLAGS=$(pkg-config crbehave --libs)
24+
echo "CRBEHAVE_LDFLAGS=${CRBEHAVE_LDFLAGS}"
25+
26+
echo "create: Makefile"
27+
sed \
28+
-e "s|@prefix@|${prefix}|g" \
29+
-e "s|@CRBEHAVE_CFLAGS@|${CRBEHAVE_CFLAGS}|g" \
30+
-e "s|@CRBEHAVE_LDFLAGS@|${CRBEHAVE_LDFLAGS}|g" \
31+
Makefile.in >Makefile

0 commit comments

Comments
 (0)