Add support for HTTPS, Windows, and Linux builds to Makefile
This commit is contained in:
@@ -1,12 +1,29 @@
|
||||
|
||||
CFLAGS = -ggdb
|
||||
LFLAGS =
|
||||
|
||||
ifeq ($(shell uname -s),Linux)
|
||||
EXT =
|
||||
else
|
||||
EXT = .exe
|
||||
LFLAGS += -lws2_32
|
||||
endif
|
||||
|
||||
HTTPS ?= 0
|
||||
ifneq ($(HTTPS),0)
|
||||
CFLAGS += -DHTTPS_ENABLED
|
||||
LFLAGS += -lcrypto -lssl
|
||||
endif
|
||||
|
||||
.PHONY: all clean example
|
||||
|
||||
all: chttp.c chttp.h simple_client simple_server
|
||||
all: chttp.c chttp.h simple_client$(EXT) simple_server$(EXT)
|
||||
|
||||
chttp.c chttp.h: $(wildcard src/*.c src/*.h) misc/amalg.py Makefile
|
||||
python misc/amalg.py
|
||||
|
||||
%: examples/%.c chttp.c chttp.h
|
||||
gcc $< chttp.c -o $@ -ggdb
|
||||
%$(EXT): examples/%.c chttp.c chttp.h
|
||||
gcc $< chttp.c -o $@ $(CFLAGS) $(LFLAGS)
|
||||
|
||||
clean:
|
||||
rm chttp.c chttp.h
|
||||
rm chttp.c chttp.h simple_client simple_client.exe simple_server simple_server.exe
|
||||
|
||||
Reference in New Issue
Block a user