Introduction
I started following the Unix Network programming 2003 book. I downloaded the source code from the official site here: source code , This includes a README file that tells how to create / compile all the files included in the book.
I followed these instructions on this github page (which also has the source code) github And I managed to use make files and correctly configure the source from what it seems.
Makefile for compiling the above examples
The first chapter of the program examples is given in the directory highlighted below. My program is “[BOOK] daytimetcpcli.c" and put it in the provided Makefile. Makefile Inside the target directory:
unpv13e / intro $
(includes all other programs with sample books)
include ../Make.defines
PROGS = [BOOK]daytimetcpcli.c daytimetcpcli1 daytimetcpcli2 daytimetcpcli3 \
daytimetcpsrv daytimetcpsrv1 daytimetcpsrv2 daytimetcpsrv3 \
daytimetcpcliv6 daytimetcpsrvv6 \
byteorder
all: ${PROGS}
[BOOK]daytimetcpcli: [BOOK]daytimetcpcli.o
${CC} ${CFLAGS} -o $@ [BOOK]daytimetcpcli.o ${LIBS}
daytimetcpcli1: daytimetcpcli1.o
${CC} ${CFLAGS} -o $@ daytimetcpcli1.o ${LIBS}
daytimetcpcli2: daytimetcpcli2.o
${CC} ${CFLAGS} -o $@ daytimetcpcli2.o ${LIBS}
daytimetcpcli3: daytimetcpcli3.o
${CC} ${CFLAGS} -o $@ daytimetcpcli3.o ${LIBS}
daytimetcpsrv: daytimetcpsrv.o
${CC} ${CFLAGS} -o $@ daytimetcpsrv.o ${LIBS}
daytimetcpsrv1: daytimetcpsrv1.o
${CC} ${CFLAGS} -o $@ daytimetcpsrv1.o ${LIBS}
daytimetcpsrv2: daytimetcpsrv2.o
${CC} ${CFLAGS} -o $@ daytimetcpsrv2.o ${LIBS}
daytimetcpsrv3: daytimetcpsrv3.o
${CC} ${CFLAGS} -o $@ daytimetcpsrv3.o ${LIBS}
daytimetcpcliv6: daytimetcpcliv6.o
${CC} ${CFLAGS} -o $@ daytimetcpcliv6.o ${LIBS}
daytimetcpsrvv6: daytimetcpsrvv6.o
${CC} ${CFLAGS} -o $@ daytimetcpsrvv6.o ${LIBS}
byteorder: byteorder.o
${CC} ${CFLAGS} -o $@ byteorder.o ${LIBS}
clean:
rm -f ${PROGS} ${CLEANFILES}
Problem
I put the file in the Makefile. However, when I run make again. It happens:
make: do nothing for "everything."
I also tried just normal compilation with GCC:
gcc [BOOK] daytimetcpcli.c
fatal error: unp.h: no such file or directory
So my question is: how do I compile my program using Makefile? what did i do right? And I know that I can compile GCC, but I don’t know what syntax to include the header files needed for GCC. This is why I tried to do this using the Makefile.
, make ? ( gcc -I)? gcc program.c -I unp.h?
* : [BOOK] daytimetcpcli.c '= daytimetcpcli.c , , .