diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2023-06-21 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2023-12-17 14:59:19 +0500 |
commit | 5b39dc76f1bc82f941d5c800ab9f34407a06b53a (patch) | |
tree | fe5e17420300b715021a76328444088d32047963 /C/7zip_gcc_c.mak | |
parent | 93be7d4abfd4233228f58ee1fbbcd76d91be66a4 (diff) | |
download | 7zip-23.01.tar.gz 7zip-23.01.tar.bz2 7zip-23.01.zip |
23.0123.01
Diffstat (limited to 'C/7zip_gcc_c.mak')
-rw-r--r-- | C/7zip_gcc_c.mak | 75 |
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) | |||
4 | MY_ASM = jwasm | 4 | MY_ASM = jwasm |
5 | MY_ASM = asmc | 5 | MY_ASM = asmc |
6 | 6 | ||
7 | ifndef RC | ||
8 | #RC=windres.exe --target=pe-x86-64 | ||
9 | #RC=windres.exe -F pe-i386 | ||
10 | RC=windres.exe | ||
11 | endif | ||
12 | |||
7 | PROGPATH = $(O)/$(PROG) | 13 | PROGPATH = $(O)/$(PROG) |
8 | PROGPATH_STATIC = $(O)/$(PROG)s | 14 | PROGPATH_STATIC = $(O)/$(PROG)s |
9 | 15 | ||
16 | ifneq ($(CC), xlc) | ||
17 | CFLAGS_WARN_WALL = -Wall -Werror -Wextra | ||
18 | endif | ||
10 | 19 | ||
11 | # for object file | 20 | # for object file |
12 | CFLAGS_BASE_LIST = -c | 21 | CFLAGS_BASE_LIST = -c |
13 | # for ASM file | 22 | # for ASM file |
14 | # CFLAGS_BASE_LIST = -S | 23 | # CFLAGS_BASE_LIST = -S |
15 | CFLAGS_BASE = $(MY_ARCH_2) -O2 $(CFLAGS_BASE_LIST) -Wall -Werror -Wextra $(CFLAGS_WARN) \ | 24 | |
25 | FLAGS_FLTO = | ||
26 | FLAGS_FLTO = -flto | ||
27 | |||
28 | CFLAGS_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 | |||
93 | endif | 106 | endif |
94 | 107 | ||
95 | 108 | ||
96 | LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32 | 109 | LIB2 = -lOle32 -loleaut32 -luuid -ladvapi32 -lUser32 -lShell32 |
97 | 110 | ||
98 | CXXFLAGS_EXTRA = -DUNICODE -D_UNICODE | 111 | CFLAGS_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 | ||
104 | RM = rm -f | 117 | RM = rm -f |
105 | MY_MKDIR=mkdir -p | 118 | MY_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) | |||
115 | endif | 128 | endif |
116 | 129 | ||
117 | 130 | ||
118 | |||
119 | CFLAGS = $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(CC_SHARED) -o $@ | ||
120 | |||
121 | |||
122 | ifdef IS_X64 | 131 | ifdef IS_X64 |
123 | AFLAGS_ABI = -elf64 -DABI_LINUX | 132 | AFLAGS_ABI = -elf64 -DABI_LINUX |
124 | else | 133 | else |
@@ -129,12 +138,9 @@ AFLAGS_ABI = -elf -DABI_LINUX -DABI_CDECL | |||
129 | endif | 138 | endif |
130 | AFLAGS = $(AFLAGS_ABI) -Fo$(O)/ | 139 | AFLAGS = $(AFLAGS_ABI) -Fo$(O)/ |
131 | 140 | ||
141 | C_WARN_FLAGS = | ||
132 | 142 | ||
133 | CXX_WARN_FLAGS = | 143 | CFLAGS = $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(CFLAGS_EXTRA) $(C_WARN_FLAGS) $(FLAGS_FLTO) $(CC_SHARED) -o $@ |
134 | #-Wno-invalid-offsetof | ||
135 | #-Wno-reorder | ||
136 | |||
137 | CXXFLAGS = $(LOCAL_FLAGS) $(CXXFLAGS_BASE2) $(CFLAGS_BASE) $(CXXFLAGS_EXTRA) $(CC_SHARED) -o $@ $(CXX_WARN_FLAGS) | ||
138 | 144 | ||
139 | STATIC_TARGET= | 145 | STATIC_TARGET= |
140 | ifdef COMPL_STATIC | 146 | ifdef 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 | ||
150 | LFLAGS_ALL = -s $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) | 156 | ifneq ($(CC), $(CROSS_COMPILE)clang) |
157 | LFLAGS_STRIP = -s | ||
158 | endif | ||
159 | |||
160 | LFLAGS_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 | ||
158 | ifndef NO_DEFAULT_RES | 168 | ifndef 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 |
161 | endif | 173 | endif |
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 | ||
265 | ifdef USE_ASM | 288 | ifdef USE_ASM |
@@ -310,7 +333,7 @@ $O/LzmaDecOpt.o: ../../../Asm/arm64/LzmaDecOpt.S ../../../Asm/arm64/7zAsm.S | |||
310 | endif | 333 | endif |
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 | ||
315 | else | 338 | else |
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 | ||
342 | clean: | 359 | clean: |