Add support for HTTPS, Windows, and Linux builds to Makefile

This commit is contained in:
2025-11-26 16:10:52 +01:00
parent 52ee89252c
commit bb753ad8ee
2 changed files with 24 additions and 7 deletions
+21 -4
View File
@@ -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