Skip to Main Content
Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)
book

Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)

by Zed A. Shaw
July 2015
Intermediate to advanced content levelIntermediate to advanced
380 pages
10h 15m
English
Addison-Wesley Professional
Content preview from Learn C the Hard Way: Practical Exercises on the Computational Subjects You Keep Avoiding (Like C)

Exercise 45. A Simple TCP/IP Client

Im going to use the RingBuffer to create a very simplistic network testing tool that I call netclient. To do this, I have to add some stuff to the Makefile to handle little programs in the bin/ directory.

Augment the Makefile

First, add a variable for the programs just like the unit test’s TESTS and TEST_SRC variables:

PROGRAMS_SRC=$(wildcard bin/*.c) PROGRAMS=$(patsubst %.c,%,$(PROGRAMS_SRC))

Then, you want to add the PROGRAMS to the all target:

all: $(TARGET) $(SO_TARGET) tests $(PROGRAMS)

Then, add PROGRAMS to the rm line in the clean target:

rm –rf build $(OBJECTS) $(TESTS) $(PROGRAMS)

Finally, you just need a target ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language

Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language

Slobodan Dmitrović

Publisher Resources

ISBN: 9780133124385Purchase Link