Introduction
I've started following the book Unix Network programming 2003. I've downloaded the source code from the official website here: source code. This includes a README file, which tells you how to build/compile all the files included for the book.
I followed these instructions on this GitHub page (which also has the source code) github And managed to use the make files and configure the source successfully from what it seems.
Makefile to compile the examples provided
The first chapter of the program examples are in directory highlighted below.My program is '[BOOK]daytimetcpcli.c' and placed it inside the Makefile provided. Makefile Inside the target directory:
unpv13e/intro$
(includes all the other book example programs)
include ../Make.definesPROGS = [BOOK]daytimetcpcli.c daytimetcpcli1 daytimetcpcli2 daytimetcpcli3 \ daytimetcpsrv daytimetcpsrv1 daytimetcpsrv2 daytimetcpsrv3 \ daytimetcpcliv6 daytimetcpsrvv6 \ byteorderall: ${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}
The Problem
I placed my file inside the Makefile. However when i run 'make' again. This occurs:
make: Nothing to be done for 'all'.
I also tried just normal compiling 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 with the Makefile provided? is what I've done correct? And I know I can compile with GCC, however I do not know the syntax to include the header files needed with GCC. Which is why I've attempted to do it with the Makefile.
Which follows into my second question, how do I compile without the makefile? (using gcc with the correct -I headers)? gcc program.c -I unp.h ?
*Note '[BOOK]daytimetcpcli.c' = daytimetcpcli.c in the source code provided on official website, in the source.