2023-12-17 18:14:08 +08:00
|
|
|
PROG ?= ./example # Program we are building
|
|
|
|
DELETE ?= rm -rf # Command to remove files
|
2023-11-08 17:39:56 +08:00
|
|
|
OUT ?= -o $(PROG) # Compiler argument for output file
|
2023-11-15 21:10:42 +08:00
|
|
|
SOURCES = main.c net.c mongoose.c # Source code files
|
2023-12-17 18:14:08 +08:00
|
|
|
CFLAGS ?= -W -Wall -Wextra -g -I. # Build options
|
2023-11-08 17:39:56 +08:00
|
|
|
|
|
|
|
# Mongoose build options. See https://mongoose.ws/documentation/#build-options
|
|
|
|
CFLAGS_MONGOOSE += -DMG_ENABLE_LINES=1
|
|
|
|
|
2023-12-17 18:14:08 +08:00
|
|
|
ifeq ($(OS),Windows_NT) # Windows settings for MinGW compiler. To use VC: make CC=cl CFLAGS=/MD OUT=/Feexample.exe
|
|
|
|
PROG = example.exe # Use .exe suffix for the binary
|
2023-11-08 17:39:56 +08:00
|
|
|
CC = gcc # Use MinGW gcc compiler
|
2023-12-17 18:14:08 +08:00
|
|
|
CFLAGS += -lws2_32 # Link against the Winsock library
|
2023-11-08 17:39:56 +08:00
|
|
|
DELETE = cmd /C del /Q /F /S # Command prompt command to delete files
|
|
|
|
endif
|
|
|
|
|
2023-12-17 18:14:08 +08:00
|
|
|
all: $(PROG)
|
|
|
|
$(RUN) $(PROG) $(ARGS)
|
2023-11-08 17:39:56 +08:00
|
|
|
|
2023-12-17 18:14:08 +08:00
|
|
|
$(PROG): $(SOURCES)
|
2023-11-08 17:39:56 +08:00
|
|
|
$(CC) $(SOURCES) $(CFLAGS) $(CFLAGS_MONGOOSE) $(CFLAGS_EXTRA) $(OUT)
|
|
|
|
|
2023-12-17 18:14:08 +08:00
|
|
|
clean:
|
|
|
|
$(DELETE) $(PROG) *.o *.obj *.exe *.dSYM
|