-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
43 lines (34 loc) · 839 Bytes
/
Copy pathmakefile
File metadata and controls
43 lines (34 loc) · 839 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
TARGET = eea
CC = gcc
CFLAGS = -Wall -g -pedantic
LIBS = -lcrypto -lpthread
INCLUDES = -I headers/
OBJDIR = obj
all: $(TARGET)
debug: CFLAGS = -Wall -g -pedantic
debug: $(TARGET)
release: CFLAGS = -O2
release: $(TARGET)
SRCS = $(wildcard src/*.c)
HEADERS = $(wildcard headers/*.h)
OBJS = $(patsubst %.c, $(OBJDIR)/%.o, $(SRCS))
ifeq ($(OS),Windows_NT)
RCS = $(wildcard version/*.rc)
RES = $(patsubst %.rc, $(OBJDIR)/%.res, $(RCS))
DEFINES = -DWIN32
endif
$(TARGET): $(OBJS) $(RES)
@$(CC) $(OBJS) $(RES) $(LIBS) -o $@
@echo "Created: "$@
$(OBJDIR)/%.res: %.rc
ifeq ($(OS),Windows_NT)
@mkdir -p $(@D)
@windres $(RCSDEBUG) $< -O coff -o $@
@echo "windres "$@
endif
$(OBJDIR)/%.o: %.c $(HEADERS)
@mkdir -p $(@D)
@$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
@echo $(CC) " "$@
clean:
$(RM) -r $(OBJDIR) $(TARGET)