-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (34 loc) · 845 Bytes
/
Makefile
File metadata and controls
46 lines (34 loc) · 845 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
43
44
45
46
#LIBRARY_NAME = socket
#SRC_FILES = src/main.c
#OBJ_FILES = $(SRC_FILES:.c=.o)
#CC = gcc
#CFLAGS = -Wall -fPIC
#all: $(LIBRARY_NAME).so
#%.o: %.c
# $(CC) $(CFLAGS) -c %< -o $@
#$(LIBRARY_NAME).so: $(OBJ)
# $(CC) -shared -Wl,-soname,$(LIBRARY_NAME).so -o $(LIBRARY_NAME).so $(OBJ)
#clean:
# rm -f $(OBJ) $(LIBRARY_NAME).so*
# Compiler
CC = gcc
# Compiler flags
CFLAGS = -Wall -Wextra -Iinclude -I/usr/include -g
LDFLAGS = -L/usr/include -l ssl -l crypto
# Source files
SRCS = $(wildcard src/*/*.c) src/libsocket.c
# Object files
OBJS = $(SRCS:.c=.o)
# Executable name
EXEC = fwd
# Default target
all: $(EXEC)
# Compile source files to object files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Link object files to create the executable
$(EXEC): $(OBJS)
$(CC) $(OBJS) -o $(EXEC) ${LDFLAGS}
# Clean build files
clean:
rm -f $(OBJS) $(EXEC)