Some compile fixes for Cygwin + improved Makefile to generate version info (on Windows).
This commit is contained in:
parent
23df735ba2
commit
aeb7d1af4a
23
Makefile
23
Makefile
@ -21,27 +21,25 @@ CFLAGS = -I$(SUBDIR_LIB)/include -Wall -Wno-trigraphs -march=$(MARCH) -mtune=$(M
|
|||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifeq ($(DEBUG),1)
|
||||||
CFLAGS += -Og -g
|
CFLAGS += -Og -g
|
||||||
|
CONFIG := _g
|
||||||
undefine LDFLGS
|
undefine LDFLGS
|
||||||
else
|
else
|
||||||
CFLAGS += -O3 -DNDEBUG
|
CFLAGS += -O3 -DNDEBUG
|
||||||
|
undefine CONFIG
|
||||||
LDFLGS += -static -s
|
LDFLGS += -static -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
UNAME := $(shell uname)
|
||||||
LDFLGS += -municode -mconsole
|
|
||||||
endif
|
|
||||||
|
|
||||||
undefine SUFFIX
|
undefine SUFFIX
|
||||||
ifeq ($(OS),Windows_NT)
|
ifneq ($(filter MINGW% CYGWIN%,$(UNAME)),)
|
||||||
SUFFIX := .exe
|
SUFFIX := .exe
|
||||||
else
|
else
|
||||||
undefine SUFFIX
|
undefine SUFFIX
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DEBUG),1)
|
ifneq ($(filter MINGW%,$(UNAME)),)
|
||||||
CONFIG := _g
|
LDFLGS += -municode -mconsole
|
||||||
else
|
|
||||||
undefine CONFIG
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -60,6 +58,11 @@ OBJECTS_APP := $(patsubst $(SUBDIR_APP)/src/%.c,$(SUBDIR_APP)/obj/%$(CONFIG).o,$
|
|||||||
SOURCES_LIB := $(wildcard $(SUBDIR_LIB)/src/*.c)
|
SOURCES_LIB := $(wildcard $(SUBDIR_LIB)/src/*.c)
|
||||||
OBJECTS_LIB := $(patsubst $(SUBDIR_LIB)/src/%.c,$(SUBDIR_LIB)/obj/%$(CONFIG).o,$(SOURCES_LIB))
|
OBJECTS_LIB := $(patsubst $(SUBDIR_LIB)/src/%.c,$(SUBDIR_LIB)/obj/%$(CONFIG).o,$(SOURCES_LIB))
|
||||||
|
|
||||||
|
ifneq ($(filter MINGW% CYGWIN%,$(UNAME)),)
|
||||||
|
RCFILES_APP := $(wildcard $(SUBDIR_APP)/res/*.rc)
|
||||||
|
OBJECTS_APP += $(patsubst $(SUBDIR_APP)/res/%.rc,$(SUBDIR_APP)/obj/%.rsrc.o,$(RCFILES_APP))
|
||||||
|
endif
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Targets
|
# Targets
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -80,6 +83,10 @@ $(SUBDIR_APP)/obj/%$(CONFIG).o: $(SUBDIR_APP)/src/%.c
|
|||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(SUBDIR_APP)/obj/%.rsrc.o: $(SUBDIR_APP)/res/%.rc
|
||||||
|
@mkdir -p $(@D)
|
||||||
|
windres -o $@ $<
|
||||||
|
|
||||||
$(SUBDIR_LIB)/obj/%$(CONFIG).o: $(SUBDIR_LIB)/src/%.c
|
$(SUBDIR_LIB)/obj/%$(CONFIG).o: $(SUBDIR_LIB)/src/%.c
|
||||||
@mkdir -p $(@D)
|
@mkdir -p $(@D)
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
@ -36,10 +36,10 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="res\SlunkCrypt.rc" />
|
<Manifest Include="res\compatibility.manifest" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Manifest Include="res\Compatibility.manifest" />
|
<ResourceCompile Include="res\version.rc" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<VCProjectVersion>16.0</VCProjectVersion>
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
@ -43,13 +43,13 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="res\SlunkCrypt.rc">
|
<Manifest Include="res\compatibility.manifest">
|
||||||
<Filter>Resource Files</Filter>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Manifest Include="res\Compatibility.manifest">
|
|
||||||
<Filter>Resource Files</Filter>
|
<Filter>Resource Files</Filter>
|
||||||
</Manifest>
|
</Manifest>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="res\version.rc">
|
||||||
|
<Filter>Resource Files</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -72,7 +72,7 @@ static void print_manpage(const CHR *const program)
|
|||||||
|
|
||||||
static char* read_passphrase(const CHR* const file_name)
|
static char* read_passphrase(const CHR* const file_name)
|
||||||
{
|
{
|
||||||
const size_t max_len = SLUNKCRYPT_PWDLEN_MAX + 3U;
|
const size_t max_len = SLUNKCRYPT_PWDLEN_MAX + 2U;
|
||||||
char *buffer = (char*) malloc(max_len * sizeof(char));
|
char *buffer = (char*) malloc(max_len * sizeof(char));
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define OS_TYPE "Win"
|
#define OS_TYPE "Win"
|
||||||
#else
|
#else
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
#define OS_TYPE "Cygwin"
|
||||||
|
#else
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#define OS_TYPE "Linux"
|
#define OS_TYPE "Linux"
|
||||||
#else
|
#else
|
||||||
@ -30,6 +33,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__x86_64__) || defined(_M_X64)
|
#if defined(__x86_64__) || defined(_M_X64)
|
||||||
#define CPU_ARCH "x64"
|
#define CPU_ARCH "x64"
|
||||||
|
Loading…
Reference in New Issue
Block a user