2020-10-14 19:59:12 +02:00
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# Options
|
|
|
|
# ---------------------------------------------------------------------------
|
2020-10-13 23:36:58 +02:00
|
|
|
|
2020-10-14 19:59:12 +02:00
|
|
|
DEBUG ?= 0
|
|
|
|
MARCH ?= native
|
|
|
|
MTUNE ?= native
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# FLags
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
CFLAGS = -IlibMCrypt/include -march=$(MARCH) -mtune=$(MTUNE)
|
|
|
|
|
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
CFLAGS += -Og -g
|
|
|
|
undefine LDFLGS
|
|
|
|
else
|
2020-10-14 21:55:39 +02:00
|
|
|
CFLAGS += -O3 -DNDEBUG
|
2020-10-14 19:59:12 +02:00
|
|
|
LDFLGS += -static -s
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(OS),Windows_NT)
|
2020-10-14 21:55:39 +02:00
|
|
|
LDFLGS += -municode -mconsole
|
2020-10-14 19:59:12 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# File names
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
undefine SUFFIX
|
2020-10-13 23:36:58 +02:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2020-10-14 19:59:12 +02:00
|
|
|
SUFFIX := .exe
|
2020-10-13 23:36:58 +02:00
|
|
|
else
|
2020-10-14 19:59:12 +02:00
|
|
|
undefine SUFFIX
|
2020-10-13 23:36:58 +02:00
|
|
|
endif
|
|
|
|
|
2020-10-14 19:59:12 +02:00
|
|
|
ifeq ($(DEBUG),1)
|
|
|
|
NAMEX := _g
|
|
|
|
else
|
|
|
|
undefine NAMEX
|
|
|
|
endif
|
|
|
|
|
|
|
|
TARGET_APP := bin/mcrypt$(NAMEX)$(SUFFIX)
|
|
|
|
TARGET_LIB := lib/libmcrypt$(NAMEX)-1.a
|
|
|
|
|
|
|
|
SOURCES_APP := $(wildcard frontend/src/*.c)
|
|
|
|
OBJECTS_APP := $(patsubst %.c,%$(NAMEX).o,$(SOURCES_APP))
|
|
|
|
|
|
|
|
SOURCES_LIB := $(wildcard libMCrypt/src/*.c)
|
|
|
|
OBJECTS_LIB := $(patsubst %.c,%$(NAMEX).o,$(SOURCES_LIB))
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
# Targets
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
2020-10-13 23:36:58 +02:00
|
|
|
.PHONY: all clean
|
|
|
|
|
2020-10-14 19:59:12 +02:00
|
|
|
all: $(TARGET_APP)
|
|
|
|
|
|
|
|
$(TARGET_APP): $(OBJECTS_APP) $(TARGET_LIB)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLGS)
|
|
|
|
|
|
|
|
$(TARGET_LIB): $(OBJECTS_LIB)
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(AR) rcs $@ $^
|
2020-10-13 23:36:58 +02:00
|
|
|
|
2020-10-14 19:59:12 +02:00
|
|
|
%$(NAMEX).o: %.c
|
|
|
|
@mkdir -p $(@D)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
2020-10-13 23:36:58 +02:00
|
|
|
clean:
|
2020-10-14 19:59:12 +02:00
|
|
|
$(RM) $(addsuffix *crypt*,$(dir $(TARGET_APP)) $(dir $(TARGET_LIB)))
|
|
|
|
$(RM) $(addsuffix *.o,$(dir $(OBJECTS_APP)) $(dir $(OBJECTS_LIB)))
|