summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 5 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b1de31f..eadce97 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
CC = gcc
-CFLAGS = -Wall -Wextra -O2 -g -std=c11 -fwrapv
+CFLAGS = -Wall -Wextra -O2 -g -std=c11 -fwrapv -pthread
+LDFLAGS = -pthread
-TARGETS = server client
+TARGETS = server client serverd clientd
SOURCES = $(filter-out $(patsubst %,%.c,$(TARGETS)),$(wildcard *.c))
OBJECTS = $(patsubst %.c,%.o,$(SOURCES))
@@ -14,11 +15,8 @@ clean:
rm -f $(TARGETS) *.o
-server: server.o $(OBJECTS)
- $(CC) $(CFLAGS) $^ -o $@
-
-client: client.o $(OBJECTS)
- $(CC) $(CFLAGS) $^ -o $@
+$(TARGETS): %: %.o $(OBJECTS)
+ $(CC) $^ -o $@ $(LDFLAGS)
%.o: %.c $(wildcard *.h)
$(CC) $(CFLAGS) -c -o $@ $<