-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
42 lines (32 loc) · 871 Bytes
/
Copy pathmakefile
File metadata and controls
42 lines (32 loc) · 871 Bytes
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
36
37
38
39
40
41
42
# =============================================================================
# MAKEFILE FOR TINY SSL SERVER
# =============================================================================
.PHONY: all clean
# Compiler and paths
CC = cc
OPENSSL_PATH = /opt/homebrew/opt/openssl@3
CFLAGS = -std=c2x -I$(OPENSSL_PATH)/include
LDFLAGS = -L$(OPENSSL_PATH)/lib -lssl -lcrypto
# Directories
BIN_DIR = .bin
OBJ_DIR = .obj
# Files
TARGET = $(BIN_DIR)/tinyserver
SRC = src/tinyserver.c
OBJ = $(OBJ_DIR)/tinyserver.o
# Default target
all: $(TARGET)
# Link executable
$(TARGET): $(OBJ) | $(BIN_DIR)
$(CC) -o $(TARGET) $(OBJ) $(LDFLAGS)
# Compile object file
$(OBJ): $(SRC) | $(OBJ_DIR)
$(CC) $(CFLAGS) -c $(SRC) -o $(OBJ)
# Create directories
$(BIN_DIR):
mkdir -p $(BIN_DIR)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
# Clean build artifacts
clean:
rm -rf $(BIN_DIR) $(OBJ_DIR)