#!/bin/sh

mkdir -p top/test
echo 'void func01(void) { int x=1245; }' > top/top.c
cat <<FILE > top/test/unittest.c
extern void func01(void);
int main(int argc, char* argv[])
{
func01();
return 0;
}
FILE
cat << MAKE > top/test/Makefile

OBJS=../top.o unittest.o
LD_FLAGS=-fprofile-arcs
unittest: $(OBJS)
gcc (LD_FLAGS)
%.o: %.c
gcc —coverage -c -o <
MAKE
cd top/test
make
