1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| CC = gcc
CFLAGS = -O2 -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int -Werror-implicit-function-declaration -Wmain -Wparentheses -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wformat -Wmissing-format-attribute -Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wlong-long
INCLUDE_DIR =
LIBS =
LIB_DIR =
EXEC_CL = client
EXEC_SE = server
CSRC = $(wildcard *.c)
COBJ_C = $(patsubst %.c, %.$(EXEC_CL).o, $(CSRC))
COBJ_S = $(patsubst %.c, %.$(EXEC_SE).o, $(CSRC))
DEFAULT: all
all: $(EXEC_CL) $(EXEC_SE)
$(EXEC_CL): $(COBJ_C)
@$(CC) -DCLIENT $(LIB_DIR) $(COBJ_C) $(LIBS) -o $@
$(EXEC_SE): $(COBJ_S)
@$(CC) -DSERVER $(LIB_DIR) $(COBJ_S) $(LIBS) -o $@
$(COBJ_C): %.$(EXEC_CL).o : %.c
@$(CC) $(CFLAGS) -DCLIENT $(INCLUDE_DIR) -c $< -o $@
$(COBJ_S): %.$(EXEC_SE).o : %.c
@$(CC) $(CFLAGS) -DSERVER $(INCLUDE_DIR) -c $< -o $@
.PHONY: clean mrproper
clean:
@rm -f *.[oa] *~
mrproper: clean
@rm -f $(EXEC_CL)
@rm -f $(EXEC_SE) |
Partager