2020-04-24 23:06:34 +02:00
|
|
|
MKDIR_P := mkdir -p
|
|
|
|
CP := cp
|
|
|
|
MV := mv
|
|
|
|
CC := gcc
|
|
|
|
CCC := g++
|
|
|
|
RM_RF = rm -rf
|
|
|
|
|
|
|
|
# directories
|
|
|
|
CWD := $(realpath .)
|
|
|
|
BINDIR := $(CWD)/bin
|
|
|
|
BUILDDIR := $(CWD)/build
|
|
|
|
SRCDIR := $(CWD)/src
|
|
|
|
INCLUDEDIR := $(CWD)/include
|
|
|
|
|
|
|
|
# flas
|
2020-05-01 16:11:21 +02:00
|
|
|
CFLAGS := -O2 -I$(INCLUDEDIR) -Wall -Wextra -Wpedantic -std=gnu11
|
2020-04-24 23:06:34 +02:00
|
|
|
LDFLAGS := -pthread
|
|
|
|
|
|
|
|
# target files
|
|
|
|
DIRS_TARGET := $(BINDIR) $(BUILDDIR)
|
|
|
|
TARGET := $(BINDIR)/mailattach
|
|
|
|
SRCFILES := $(wildcard $(SRCDIR)/*.c)
|
|
|
|
OBJFILES := $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRCFILES))
|
|
|
|
|
|
|
|
# fancy targets
|
|
|
|
all: directories $(TARGET)
|
|
|
|
|
|
|
|
directories: $(DIRS_TARGET)
|
|
|
|
|
|
|
|
# less fancy targets
|
|
|
|
|
|
|
|
$(DIRS_TARGET):
|
|
|
|
$(MKDIR_P) $@
|
|
|
|
|
|
|
|
$(TARGET): $(OBJFILES)
|
2020-04-26 18:01:10 +02:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
2020-04-24 23:06:34 +02:00
|
|
|
|
|
|
|
$(BUILDDIR)/%.o: $(SRCDIR)/%.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(RM_RF) $(DIRS_TARGET)
|