1 # ---------------------------------------------------------------------------
3 # ---------------------------------------------------------------------------
17 # ---------------------------------------------------------------------------
19 # ---------------------------------------------------------------------------
21 SUBDIR_APP
:= frontend
22 SUBDIR_LIB
:= libslunkcrypt
24 # ---------------------------------------------------------------------------
26 # ---------------------------------------------------------------------------
30 CFLAGS
= -I
$(SUBDIR_LIB
)/include -std
=gnu99
-Wall
33 CFLAGS
+= -m
$(firstword $(CPU
))
36 CFLAGS
+= --target
=$(firstword $(TARGET
))
37 LDFLGS
+= --target
=$(firstword $(TARGET
))
41 CFLAGS
+= -march
=$(firstword $(MARCH
))
44 CFLAGS
+= -mtune
=$(firstword $(MTUNE
))
49 CFLAGS
+= -O1
-g
-fsanitize
=address
-fno-omit-frame-pointer
-fno-optimize-sibling-calls
50 else ifneq ($(DEBUG
),0)
54 CFLAGS
+= -O3
-DNDEBUG
59 CFLAGS
+= -fprofile-
$(firstword $(FPGO
))
66 MACHINE
:= $(shell $(CC
) -dumpmachine || echo unknown
)
68 ifeq ($(MACHINE
),$(filter %mingw32
%-windows-gnu
%-cygwin
%-cygnus
,$(MACHINE
)))
75 CFLAGS
+= -DSLUNKBUILD_NOTHREADS
86 ifeq ($(MACHINE
),$(filter %-w64-mingw32
%w64-windows-gnu
,$(MACHINE
)))
87 LDFLGS
+= -mconsole
-municode
90 # ---------------------------------------------------------------------------
92 # ---------------------------------------------------------------------------
94 OUTNAME_APP
:= slunkcrypt
$(CONFIG
)$(SUFFIX
)
95 OUTNAME_LIB
:= libslunkcrypt
$(CONFIG
)-1.a
97 OUTPATH_APP
:= $(SUBDIR_APP
)/bin
/$(OUTNAME_APP
)
98 OUTPATH_LIB
:= $(SUBDIR_LIB
)/lib
/$(OUTNAME_LIB
)
100 SOURCES_APP
:= $(wildcard $(SUBDIR_APP
)/src
/*.c
)
101 OBJECTS_APP
:= $(patsubst $(SUBDIR_APP
)/src
/%.c
,$(SUBDIR_APP
)/obj
/%$(CONFIG
).o
,$(SOURCES_APP
))
103 SOURCES_LIB
:= $(wildcard $(SUBDIR_LIB
)/src
/*.c
)
104 OBJECTS_LIB
:= $(patsubst $(SUBDIR_LIB
)/src
/%.c
,$(SUBDIR_LIB
)/obj
/%$(CONFIG
).o
,$(SOURCES_LIB
))
106 ifneq ($(filter %-mingw32
%-windows-gnu
%-cygwin
%-cygnus
,$(MACHINE
)),)
107 RCFILES_APP
:= $(wildcard $(SUBDIR_APP
)/res
/*.rc
)
108 OBJECTS_APP
+= $(patsubst $(SUBDIR_APP
)/res
/%.rc
,$(SUBDIR_APP
)/obj
/%.rsrc.o
,$(RCFILES_APP
))
111 # ---------------------------------------------------------------------------
113 # ---------------------------------------------------------------------------
119 $(OUTPATH_APP
): $(OBJECTS_APP
) $(OUTPATH_LIB
)
121 $(CC
) $(CFLAGS
) $^
-o
$@
$(LDFLGS
)
123 $(OUTPATH_LIB
): $(OBJECTS_LIB
)
127 $(SUBDIR_APP
)/obj
/%$(CONFIG
).o
: $(SUBDIR_APP
)/src
/%.c
129 $(CC
) $(CFLAGS
) -c
$< -o
$@
131 $(SUBDIR_APP
)/obj
/%.rsrc.o
: $(SUBDIR_APP
)/res
/%.rc
135 $(SUBDIR_LIB
)/obj
/%$(CONFIG
).o
: $(SUBDIR_LIB
)/src
/%.c
137 $(CC
) $(CFLAGS
) -c
$< -o
$@
140 $(RM
) $(SUBDIR_APP
)/obj
/*.o
$(SUBDIR_APP
)/obj
/*.gcda
$(SUBDIR_APP
)/lib
/*.a
$(SUBDIR_APP
)/bin
/*$(SUFFIX
)
141 $(RM
) $(SUBDIR_LIB
)/obj
/*.o
$(SUBDIR_LIB
)/obj
/*.gcda
$(SUBDIR_LIB
)/lib
/*.a
$(SUBDIR_LIB
)/bin
/*$(SUFFIX
)