OLD | NEW |
(Empty) | |
| 1 ############################################################################### |
| 2 # |
| 3 # Makefile to build XZ Utils using DJGPP |
| 4 # |
| 5 # Make flags to alter compilation: |
| 6 # |
| 7 # DEBUG=1 Enable assertions. Don't use this for production builds! |
| 8 # You may also want to set CFLAGS="-g -O0" to disable |
| 9 # optimizations. |
| 10 # |
| 11 # The usual CPPFLAGS and CFLAGS are supported too. |
| 12 # |
| 13 ############################################################################### |
| 14 # |
| 15 # Author: Lasse Collin |
| 16 # |
| 17 # This file has been put into the public domain. |
| 18 # You can do whatever you want with this file. |
| 19 # |
| 20 ############################################################################### |
| 21 |
| 22 CC = gcc |
| 23 AR = ar |
| 24 STRIP = strip |
| 25 SED = sed |
| 26 RM = rm -f |
| 27 |
| 28 CFLAGS = -g -Wextra -Wfatal-errors -Wall -march=i386 -mtune=i686 -O2 |
| 29 |
| 30 # NOTE: -fgnu89-inline is needed on DJGPP 2.04 beta and GCC 4.3.2 |
| 31 # because time.h uses GNU-style "extern inline". |
| 32 ALL_CFLAGS = -std=gnu99 -fgnu89-inline |
| 33 |
| 34 ALL_CPPFLAGS = \ |
| 35 -I. \ |
| 36 -I../lib \ |
| 37 -I../src/common \ |
| 38 -I../src/liblzma/api \ |
| 39 -I../src/liblzma/common \ |
| 40 -I../src/liblzma/check \ |
| 41 -I../src/liblzma/rangecoder \ |
| 42 -I../src/liblzma/lz \ |
| 43 -I../src/liblzma/lzma \ |
| 44 -I../src/liblzma/delta \ |
| 45 -I../src/liblzma/simple \ |
| 46 -I../src/liblzma/subblock |
| 47 |
| 48 ALL_CPPFLAGS += -DHAVE_CONFIG_H |
| 49 |
| 50 ifdef DEBUG |
| 51 STRIP := rem Skipping strip |
| 52 else |
| 53 ALL_CPPFLAGS += -DNDEBUG |
| 54 endif |
| 55 |
| 56 ALL_CPPFLAGS += $(CPPFLAGS) |
| 57 ALL_CFLAGS += $(CFLAGS) |
| 58 |
| 59 |
| 60 ################ |
| 61 # Common rules # |
| 62 ################ |
| 63 |
| 64 .PHONY: all clean |
| 65 all: liblzma.a getopt.a xzdec.exe lzmadec.exe xz.exe |
| 66 clean: liblzma-clean getopt-clean xzdec-clean xz-clean |
| 67 |
| 68 |
| 69 ############# |
| 70 # liblzma.a # |
| 71 ############# |
| 72 |
| 73 LIBLZMA_SRCS_C = \ |
| 74 ../src/liblzma/common/alone_decoder.c \ |
| 75 ../src/liblzma/common/alone_encoder.c \ |
| 76 ../src/liblzma/common/auto_decoder.c \ |
| 77 ../src/liblzma/common/block_buffer_decoder.c \ |
| 78 ../src/liblzma/common/block_buffer_encoder.c \ |
| 79 ../src/liblzma/common/block_decoder.c \ |
| 80 ../src/liblzma/common/block_encoder.c \ |
| 81 ../src/liblzma/common/block_header_decoder.c \ |
| 82 ../src/liblzma/common/block_header_encoder.c \ |
| 83 ../src/liblzma/common/block_util.c \ |
| 84 ../src/liblzma/common/common.c \ |
| 85 ../src/liblzma/common/easy_buffer_encoder.c \ |
| 86 ../src/liblzma/common/easy_decoder_memusage.c \ |
| 87 ../src/liblzma/common/easy_encoder.c \ |
| 88 ../src/liblzma/common/easy_encoder_memusage.c \ |
| 89 ../src/liblzma/common/easy_preset.c \ |
| 90 ../src/liblzma/common/filter_common.c \ |
| 91 ../src/liblzma/common/filter_decoder.c \ |
| 92 ../src/liblzma/common/filter_encoder.c \ |
| 93 ../src/liblzma/common/filter_flags_decoder.c \ |
| 94 ../src/liblzma/common/filter_flags_encoder.c \ |
| 95 ../src/liblzma/common/index.c \ |
| 96 ../src/liblzma/common/index_decoder.c \ |
| 97 ../src/liblzma/common/index_encoder.c \ |
| 98 ../src/liblzma/common/index_hash.c \ |
| 99 ../src/liblzma/common/stream_buffer_decoder.c \ |
| 100 ../src/liblzma/common/stream_buffer_encoder.c \ |
| 101 ../src/liblzma/common/stream_decoder.c \ |
| 102 ../src/liblzma/common/stream_encoder.c \ |
| 103 ../src/liblzma/common/stream_flags_common.c \ |
| 104 ../src/liblzma/common/stream_flags_decoder.c \ |
| 105 ../src/liblzma/common/stream_flags_encoder.c \ |
| 106 ../src/liblzma/common/vli_decoder.c \ |
| 107 ../src/liblzma/common/vli_encoder.c \ |
| 108 ../src/liblzma/common/vli_size.c \ |
| 109 ../src/liblzma/check/check.c \ |
| 110 ../src/liblzma/check/crc32_table.c \ |
| 111 ../src/liblzma/check/crc64_table.c \ |
| 112 ../src/liblzma/check/sha256.c \ |
| 113 ../src/liblzma/rangecoder/price_table.c \ |
| 114 ../src/liblzma/lz/lz_decoder.c \ |
| 115 ../src/liblzma/lz/lz_encoder.c \ |
| 116 ../src/liblzma/lz/lz_encoder_mf.c \ |
| 117 ../src/liblzma/lzma/fastpos_table.c \ |
| 118 ../src/liblzma/lzma/lzma2_decoder.c \ |
| 119 ../src/liblzma/lzma/lzma2_encoder.c \ |
| 120 ../src/liblzma/lzma/lzma_decoder.c \ |
| 121 ../src/liblzma/lzma/lzma_encoder.c \ |
| 122 ../src/liblzma/lzma/lzma_encoder_optimum_fast.c \ |
| 123 ../src/liblzma/lzma/lzma_encoder_optimum_normal.c \ |
| 124 ../src/liblzma/lzma/lzma_encoder_presets.c \ |
| 125 ../src/liblzma/delta/delta_common.c \ |
| 126 ../src/liblzma/delta/delta_decoder.c \ |
| 127 ../src/liblzma/delta/delta_encoder.c \ |
| 128 ../src/liblzma/simple/arm.c \ |
| 129 ../src/liblzma/simple/armthumb.c \ |
| 130 ../src/liblzma/simple/ia64.c \ |
| 131 ../src/liblzma/simple/powerpc.c \ |
| 132 ../src/liblzma/simple/simple_coder.c \ |
| 133 ../src/liblzma/simple/simple_decoder.c \ |
| 134 ../src/liblzma/simple/simple_encoder.c \ |
| 135 ../src/liblzma/simple/sparc.c \ |
| 136 ../src/liblzma/simple/x86.c |
| 137 |
| 138 LIBLZMA_SRCS_ASM = \ |
| 139 ../src/liblzma/check/crc32_x86.S \ |
| 140 ../src/liblzma/check/crc64_x86.S |
| 141 |
| 142 LIBLZMA_OBJS_C = $(LIBLZMA_SRCS_C:.c=.o) |
| 143 LIBLZMA_OBJS_ASM = $(LIBLZMA_SRCS_ASM:.S=.o) |
| 144 LIBLZMA_OBJS = $(LIBLZMA_OBJS_C) $(LIBLZMA_OBJS_ASM) |
| 145 |
| 146 $(LIBLZMA_OBJS_C): %.o: %.c |
| 147 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< |
| 148 |
| 149 $(LIBLZMA_OBJS_ASM): %.o: %.S |
| 150 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< |
| 151 |
| 152 liblzma.a: $(LIBLZMA_OBJS) |
| 153 $(RM) $@ |
| 154 $(AR) rcs $@ $(LIBLZMA_OBJS) |
| 155 $(STRIP) --strip-unneeded $@ |
| 156 |
| 157 # Avoid too long command lines. |
| 158 .PHONY: liblzma-clean $(LIBLZMA_OBJS:.o=-clean) |
| 159 liblzma-clean: $(LIBLZMA_OBJS:.o=-clean) |
| 160 -$(RM) liblzma.a |
| 161 |
| 162 $(LIBLZMA_OBJS:.o=-clean): |
| 163 -$(RM) $(@:-clean=.o) |
| 164 |
| 165 |
| 166 ############### |
| 167 # getopt_long # |
| 168 ############### |
| 169 |
| 170 GETOPT_SRCS = \ |
| 171 ../lib/getopt.c \ |
| 172 ../lib/getopt1.c |
| 173 |
| 174 GETOPT_OBJS = $(GETOPT_SRCS:.c=.o) |
| 175 |
| 176 GETOPT_H = ../lib/getopt.h |
| 177 |
| 178 $(GETOPT_H): %.h: %.in.h |
| 179 $(SED) "" $< > $@ |
| 180 |
| 181 $(GETOPT_OBJS): %.o: %.c $(GETOPT_H) |
| 182 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< |
| 183 |
| 184 getopt.a: $(GETOPT_OBJS) |
| 185 $(RM) $@ |
| 186 $(AR) rcs $@ $(GETOPT_OBJS) |
| 187 $(STRIP) --strip-unneeded $@ |
| 188 |
| 189 getopt-clean: |
| 190 $(RM) $(GETOPT_H) $(GETOPT_OBJS) getopt.a |
| 191 |
| 192 |
| 193 ########################### |
| 194 # xzdec.exe & lzmadec.exe # |
| 195 ########################### |
| 196 |
| 197 XZDEC_SRCS = ../src/xzdec/xzdec.c |
| 198 |
| 199 xzdec.exe: getopt.a liblzma.a $(XZDEC_SRCS) |
| 200 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(XZDEC_SRCS) -o $@ getopt.a liblzma
.a |
| 201 $(STRIP) --strip-all $@ |
| 202 exe2coff $@ |
| 203 $(RM) $@ |
| 204 copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@ |
| 205 $(RM) $(@:.exe=) |
| 206 |
| 207 lzmadec.exe: getopt.a liblzma.a $(XZDEC_SRCS) |
| 208 $(CC) $(ALL_CPPFLAGS) -DLZMADEC $(ALL_CFLAGS) $(XZDEC_SRCS) -o $@ getopt
.a liblzma.a |
| 209 $(STRIP) --strip-all $@ |
| 210 exe2coff $@ |
| 211 $(RM) $@ |
| 212 copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@ |
| 213 $(RM) $(@:.exe=) |
| 214 |
| 215 .PHONY: xzdec-clean |
| 216 xzdec-clean: |
| 217 -$(RM) xzdec.exe lzmadec.exe xzdec lzmadec |
| 218 |
| 219 |
| 220 ########## |
| 221 # xz.exe # |
| 222 ########## |
| 223 |
| 224 XZ_SRCS = \ |
| 225 ../src/xz/args.c \ |
| 226 ../src/xz/coder.c \ |
| 227 ../src/xz/file_io.c \ |
| 228 ../src/xz/hardware.c \ |
| 229 ../src/xz/main.c \ |
| 230 ../src/xz/message.c \ |
| 231 ../src/xz/options.c \ |
| 232 ../src/xz/signals.c \ |
| 233 ../src/xz/suffix.c \ |
| 234 ../src/xz/util.c |
| 235 |
| 236 XZ_OBJS = $(XZ_SRCS:.c=.o) |
| 237 |
| 238 $(XZ_OBJS): %.o: %.c |
| 239 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< |
| 240 |
| 241 xz.exe: getopt.a liblzma.a $(XZ_OBJS) |
| 242 $(CC) $(ALL_CFLAGS) $(XZ_OBJS) -o $@ getopt.a liblzma.a |
| 243 $(STRIP) --strip-all $@ |
| 244 exe2coff $@ |
| 245 $(RM) $@ |
| 246 copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@ |
| 247 $(RM) $(@:.exe=) |
| 248 |
| 249 # Avoid too long command lines. |
| 250 .PHONY: xz-clean $(XZ_OBJS:.o=-clean) |
| 251 xz-clean: $(XZ_OBJS:.o=-clean) |
| 252 -$(RM) xz.exe xz |
| 253 |
| 254 $(XZ_OBJS:.o=-clean): |
| 255 -$(RM) $(@:-clean=.o) |
OLD | NEW |