aboutsummaryrefslogtreecommitdiff
path: root/C/7zip_gcc_c.mak
diff options
context:
space:
mode:
Diffstat (limited to 'C/7zip_gcc_c.mak')
-rw-r--r--C/7zip_gcc_c.mak75
1 files changed, 46 insertions, 29 deletions
diff --git a/C/7zip_gcc_c.mak b/C/7zip_gcc_c.mak
index 24505f3..f19a99b 100644
--- a/C/7zip_gcc_c.mak
+++ b/C/7zip_gcc_c.mak
@@ -4,15 +4,28 @@ MY_ARCH_2 = $(MY_ARCH)
4MY_ASM = jwasm 4MY_ASM = jwasm
5MY_ASM = asmc 5MY_ASM = asmc
6 6
7ifndef RC
8#RC=windres.exe --target=pe-x86-64
9#RC=windres.exe -F pe-i386
10RC=windres.exe
11endif
12
7PROGPATH = $(O)/$(PROG) 13PROGPATH = $(O)/$(PROG)
8PROGPATH_STATIC = $(O)/$(PROG)s 14PROGPATH_STATIC = $(O)/$(PROG)s
9 15
16ifneq ($(CC), xlc)
17CFLAGS_WARN_WALL = -Wall -Werror -Wextra
18endif
10 19
11# for object file 20# for object file
12CFLAGS_BASE_LIST = -c 21CFLAGS_BASE_LIST = -c
13# for ASM file 22# for ASM file
14# CFLAGS_BASE_LIST = -S 23# CFLAGS_BASE_LIST = -S
15CFLAGS_BASE = $(MY_ARCH_2) -O2 $(CFLAGS_BASE_LIST) -Wall -Werror -Wextra $(CFLAGS_WARN) \ 24
25FLAGS_FLTO =
26FLAGS_FLTO = -flto
27
28CFLAGS_BASE = $(MY_ARCH_2) -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \
16 -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 29 -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
17 30
18 31
@@ -93,9 +106,9 @@ DEL_OBJ_EXE = -$(RM) $(O)\*.o $(O)\$(PROG).exe $(O)\$(PROG).dll
93endif 106endif
94 107
95 108
96LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32 109LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32 -lShell32
97 110
98CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE 111CFLAGS_EXTRA = -DUNICODE -D_UNICODE
99# -Wno-delete-non-virtual-dtor 112# -Wno-delete-non-virtual-dtor
100 113
101 114
@@ -103,8 +116,8 @@ else
103 116
104RM = rm -f 117RM = rm -f
105MY_MKDIR=mkdir -p 118MY_MKDIR=mkdir -p
106# CFLAGS_BASE := $(CFLAGS_BASE) -D_7ZIP_ST 119# CFLAGS_BASE := $(CFLAGS_BASE) -DZ7_ST
107# CXXFLAGS_EXTRA = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 120# CFLAGS_EXTRA = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
108 121
109# LOCAL_LIBS=-lpthread 122# LOCAL_LIBS=-lpthread
110# LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl 123# LOCAL_LIBS_DLL=$(LOCAL_LIBS) -ldl
@@ -115,10 +128,6 @@ DEL_OBJ_EXE = -$(RM) $(PROGPATH) $(PROGPATH_STATIC) $(OBJS)
115endif 128endif
116 129
117 130
118
119CFLAGS = $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(CC_SHARED) -o $@
120
121
122ifdef IS_X64 131ifdef IS_X64
123AFLAGS_ABI = -elf64 -DABI_LINUX 132AFLAGS_ABI = -elf64 -DABI_LINUX
124else 133else
@@ -129,12 +138,9 @@ AFLAGS_ABI = -elf -DABI_LINUX -DABI_CDECL
129endif 138endif
130AFLAGS = $(AFLAGS_ABI) -Fo$(O)/ 139AFLAGS = $(AFLAGS_ABI) -Fo$(O)/
131 140
141C_WARN_FLAGS =
132 142
133CXX_WARN_FLAGS = 143CFLAGS = $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(CFLAGS_EXTRA) $(C_WARN_FLAGS) $(FLAGS_FLTO) $(CC_SHARED) -o $@
134#-Wno-invalid-offsetof
135#-Wno-reorder
136
137CXXFLAGS = $(LOCAL_FLAGS) $(CXXFLAGS_BASE2) $(CFLAGS_BASE) $(CXXFLAGS_EXTRA) $(CC_SHARED) -o $@ $(CXX_WARN_FLAGS)
138 144
139STATIC_TARGET= 145STATIC_TARGET=
140ifdef COMPL_STATIC 146ifdef COMPL_STATIC
@@ -147,18 +153,27 @@ all: $(O) $(PROGPATH) $(STATIC_TARGET)
147$(O): 153$(O):
148 $(MY_MKDIR) $(O) 154 $(MY_MKDIR) $(O)
149 155
150LFLAGS_ALL = -s $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) 156ifneq ($(CC), $(CROSS_COMPILE)clang)
157LFLAGS_STRIP = -s
158endif
159
160LFLAGS_ALL = $(LFLAGS_STRIP) $(MY_ARCH_2) $(LDFLAGS) $(FLAGS_FLTO) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2)
151$(PROGPATH): $(OBJS) 161$(PROGPATH): $(OBJS)
152 $(CXX) -o $(PROGPATH) $(LFLAGS_ALL) 162 $(CC) -o $(PROGPATH) $(LFLAGS_ALL)
153 163
154$(PROGPATH_STATIC): $(OBJS) 164$(PROGPATH_STATIC): $(OBJS)
155 $(CXX) -static -o $(PROGPATH_STATIC) $(LFLAGS_ALL) 165 $(CC) -static -o $(PROGPATH_STATIC) $(LFLAGS_ALL)
156 166
157 167
158ifndef NO_DEFAULT_RES 168ifndef NO_DEFAULT_RES
169# old mingw without -FO
170# windres.exe $(RFLAGS) resource.rc $O/resource.o
159$O/resource.o: resource.rc 171$O/resource.o: resource.rc
160 windres.exe $(RFLAGS) resource.rc $O/resource.o 172 $(RC) $(RFLAGS) resource.rc $(O)/resource.o
161endif 173endif
174# windres.exe $(RFLAGS) resource.rc $(O)\resource.o
175# windres.exe $(RFLAGS) resource.rc -FO $(O)/resource.o
176# $(RC) $(RFLAGS) resource.rc -FO $(O)/resource.o
162 177
163 178
164 179
@@ -256,10 +271,18 @@ $O/Sha256.o: ../../../C/Sha256.c
256 $(CC) $(CFLAGS) $< 271 $(CC) $(CFLAGS) $<
257$O/Sort.o: ../../../C/Sort.c 272$O/Sort.o: ../../../C/Sort.c
258 $(CC) $(CFLAGS) $< 273 $(CC) $(CFLAGS) $<
274$O/SwapBytes.o: ../../../C/SwapBytes.c
275 $(CC) $(CFLAGS) $<
259$O/Xz.o: ../../../C/Xz.c 276$O/Xz.o: ../../../C/Xz.c
260 $(CC) $(CFLAGS) $< 277 $(CC) $(CFLAGS) $<
261$O/XzCrc64.o: ../../../C/XzCrc64.c 278$O/XzCrc64.o: ../../../C/XzCrc64.c
262 $(CC) $(CFLAGS) $< 279 $(CC) $(CFLAGS) $<
280$O/XzDec.o: ../../../C/XzDec.c
281 $(CC) $(CFLAGS) $<
282$O/XzEnc.o: ../../../C/XzEnc.c
283 $(CC) $(CFLAGS) $<
284$O/XzIn.o: ../../../C/XzIn.c
285 $(CC) $(CFLAGS) $<
263 286
264 287
265ifdef USE_ASM 288ifdef USE_ASM
@@ -310,7 +333,7 @@ $O/LzmaDecOpt.o: ../../../Asm/arm64/LzmaDecOpt.S ../../../Asm/arm64/7zAsm.S
310endif 333endif
311 334
312$O/LzmaDec.o: ../../LzmaDec.c 335$O/LzmaDec.o: ../../LzmaDec.c
313 $(CC) $(CFLAGS) -D_LZMA_DEC_OPT $< 336 $(CC) $(CFLAGS) -DZ7_LZMA_DEC_OPT $<
314 337
315else 338else
316 339
@@ -321,22 +344,16 @@ endif
321 344
322 345
323 346
324$O/XzDec.o: ../../../C/XzDec.c
325 $(CC) $(CFLAGS) $<
326$O/XzEnc.o: ../../../C/XzEnc.c
327 $(CC) $(CFLAGS) $<
328$O/XzIn.o: ../../../C/XzIn.c
329 $(CC) $(CFLAGS) $<
330
331
332$O/7zMain.o: ../../../C/Util/7z/7zMain.c 347$O/7zMain.o: ../../../C/Util/7z/7zMain.c
333 $(CC) $(CFLAGS) $< 348 $(CC) $(CFLAGS) $<
334$O/LzmaUtil.o: ../../../C/Util/Lzma/LzmaUtil.c
335 $(CC) $(CFLAGS) $<
336$O/7zipInstall.o: ../../../C/Util/7zipInstall/7zipInstall.c 349$O/7zipInstall.o: ../../../C/Util/7zipInstall/7zipInstall.c
337 $(CC) $(CFLAGS) $< 350 $(CC) $(CFLAGS) $<
338$O/7zipUninstall.o: ../../../C/Util/7zipUninstall/7zipUninstall.c 351$O/7zipUninstall.o: ../../../C/Util/7zipUninstall/7zipUninstall.c
339 $(CC) $(CFLAGS) $< 352 $(CC) $(CFLAGS) $<
353$O/LzmaUtil.o: ../../../C/Util/Lzma/LzmaUtil.c
354 $(CC) $(CFLAGS) $<
355$O/XzUtil.o: ../../../C/Util/Xz/XzUtil.c
356 $(CC) $(CFLAGS) $<
340 357
341 358
342clean: 359clean: