Skip to content

Commit

Permalink
Have the example-building code look at LEBOOK_CFLAGS
Browse files Browse the repository at this point in the history
Also add a makefile for examples_R8.

Also, "make check" now tries to build all the examples.
  • Loading branch information
nmathewson committed Jan 29, 2010
1 parent 1d9d9b4 commit b564241
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
# asciidoc 8.4.3 is known to work. asciidoc 8.2.5 is known not to work.
ASCIIDOC=asciidoc

GENERATED_HTML= \
TOC.html \
GENERATED_METAFILES= \
TOC.html

GENERATED_CHAPTERS= \
00_about.html \
01_intro.html \
Ref0_meta.html \
Expand All @@ -16,12 +18,20 @@ GENERATED_HTML= \
Ref7_evbuffer.html \
Ref8_listener.html

GENERATED_HTML = $(GENERATED_METAFILES) $(GENERATED_CHAPTERS)

all: html examples

html: $(GENERATED_HTML)

check: examples inline_examples

examples:
cd examples_01 && $(MAKE)
cd examples_R8 && $(MAKE)

inline_examples:
./bin/build_examples.py *_*.txt

.SUFFIXES: .txt .html

Expand All @@ -45,6 +55,8 @@ clean:
rm -f *.o
rm -f $(GENERATED_HTML)
cd examples_01 && $(MAKE) clean
cd examples_R8 && $(MAKE) clean
rm -rf tmpcode_*

count:
wc -w *.txt
Expand Down
8 changes: 2 additions & 6 deletions examples_01/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

CC=gcc
CFLAGS=-g -Wall -L/Users/nickm/le/lib -I/Users/nickm/le/include
CFLAGS=-g -Wall $(LEBOOK_CFLAGS)

GENERATED_HTML=01_intro.html
EXAMPLE_BINARIES=01_sync_webclient 01_rot13_server_forking \
01_rot13_server_select 01_rot13_server_libevent \
01_rot13_server_bufferevent
Expand All @@ -11,8 +10,6 @@ all: examples

examples: $(EXAMPLE_BINARIES)

01_intro.html: 01_sync_webclient.c

01_sync_webclient: 01_sync_webclient.o
$(CC) $(CFLAGS) 01_sync_webclient.o -o 01_sync_webclient

Expand All @@ -26,7 +23,7 @@ examples: $(EXAMPLE_BINARIES)
$(CC) $(CFLAGS) 01_rot13_server_libevent.o -o 01_rot13_server_libevent -levent_core

01_rot13_server_bufferevent: 01_rot13_server_bufferevent.o
$(CC) $(CFLAGS) /Users/nickm/le/lib/libevent_core.a 01_rot13_server_bufferevent.o -o 01_rot13_server_bufferevent
$(CC) $(CFLAGS) 01_rot13_server_bufferevent.o -o 01_rot13_server_bufferevent -levent_core

.c.o:
$(CC) $(CFLAGS) -c $<
Expand All @@ -35,4 +32,3 @@ clean:
rm -f *~
rm -f *.o
rm -f $(EXAMPLE_BINARIES)
rm -f $(GENERATED_HTML)
20 changes: 20 additions & 0 deletions examples_R8/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

CC=gcc
CFLAGS=-g -Wall $(LEBOOK_CFLAGS)

EXAMPLE_BINARIES=R8_echo_server

all: examples

examples: $(EXAMPLE_BINARIES)

R8_echo_server: R8_echo_server.o
$(CC) $(CFLAGS) R8_echo_server.o -o R8_echo_server -levent_core

.c.o:
$(CC) $(CFLAGS) -c $<

clean:
rm -f *~
rm -f *.o
rm -f $(EXAMPLE_BINARIES)

0 comments on commit b564241

Please sign in to comment.