Build examples in a build directory
This commit is contained in:
60
Makefile
60
Makefile
@@ -2,43 +2,45 @@ CC=gcc
|
||||
CFLAGS=-Wall -Wextra -ggdb -I.
|
||||
LDFLAGS=-lpthread
|
||||
|
||||
all: hello_server hello_client hello_server_v6 hello_client_v6 chat_server \
|
||||
chat_client udp_server udp_client http_request
|
||||
all: build/hello_server build/hello_client build/hello_server_v6 \
|
||||
build/hello_client_v6 build/chat_server build/chat_client \
|
||||
build/udp_server build/udp_client build/http_request
|
||||
|
||||
hello_server: examples/hello_server.c
|
||||
$(CC) $(CFLAGS) -o hello_server examples/hello_server.c $(LDFLAGS)
|
||||
build/hello_server: examples/hello_server.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/hello_server examples/hello_server.c $(LDFLAGS)
|
||||
|
||||
hello_client: examples/hello_client.c
|
||||
$(CC) $(CFLAGS) -o hello_client examples/hello_client.c $(LDFLAGS)
|
||||
build/hello_client: examples/hello_client.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/hello_client examples/hello_client.c $(LDFLAGS)
|
||||
|
||||
hello_server_v6: examples/hello_server_v6.c
|
||||
$(CC) $(CFLAGS) -o hello_server_v6 examples/hello_server_v6.c $(LDFLAGS)
|
||||
build/hello_server_v6: examples/hello_server_v6.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/hello_server_v6 examples/hello_server_v6.c $(LDFLAGS)
|
||||
|
||||
hello_client_v6: examples/hello_client_v6.c
|
||||
$(CC) $(CFLAGS) -o hello_client_v6 examples/hello_client_v6.c $(LDFLAGS)
|
||||
build/hello_client_v6: examples/hello_client_v6.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/hello_client_v6 examples/hello_client_v6.c $(LDFLAGS)
|
||||
|
||||
chat_server: examples/chat_server.c
|
||||
$(CC) $(CFLAGS) -o chat_server examples/chat_server.c $(LDFLAGS)
|
||||
build/chat_server: examples/chat_server.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/chat_server examples/chat_server.c $(LDFLAGS)
|
||||
|
||||
chat_client: examples/chat_client.c
|
||||
$(CC) $(CFLAGS) -o chat_client examples/chat_client.c $(LDFLAGS)
|
||||
build/chat_client: examples/chat_client.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/chat_client examples/chat_client.c $(LDFLAGS)
|
||||
|
||||
udp_server: examples/udp_server.c
|
||||
$(CC) $(CFLAGS) -o udp_server examples/udp_server.c $(LDFLAGS)
|
||||
build/udp_server: examples/udp_server.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/udp_server examples/udp_server.c $(LDFLAGS)
|
||||
|
||||
udp_client: examples/udp_client.c
|
||||
$(CC) $(CFLAGS) -o udp_client examples/udp_client.c $(LDFLAGS)
|
||||
build/udp_client: examples/udp_client.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/udp_client examples/udp_client.c $(LDFLAGS)
|
||||
|
||||
http_request: examples/http_request.c
|
||||
$(CC) $(CFLAGS) -o http_request examples/http_request.c $(LDFLAGS)
|
||||
build/http_request: examples/http_request.c
|
||||
@mkdir -p build
|
||||
$(CC) $(CFLAGS) -o build/http_request examples/http_request.c $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf chat_server
|
||||
rm -rf chat_client
|
||||
rm -rf hello_server
|
||||
rm -rf hello_client
|
||||
rm -rf hello_server_v6
|
||||
rm -rf hello_client_v6
|
||||
rm -rf udp_server
|
||||
rm -rf udp_client
|
||||
rm -rf http_request
|
||||
rm -rf build
|
||||
|
||||
Reference in New Issue
Block a user