diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2010-10-09 19:28:49 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2010-10-09 19:28:49 +0300 |
commit | 5629c4be07b6c67e79842b2569da1cedc9c0d69a (patch) | |
tree | 5bad7e5c6db9ac9dbed4987810952184dbe33271 /dos/Makefile | |
parent | Windows: Put some license info into README-Windows.txt. (diff) | |
download | xz-5629c4be07b6c67e79842b2569da1cedc9c0d69a.tar.xz |
DOS: Update the Makefile, config.h and README.
This is now simpler and builds only xz.exe.
Diffstat (limited to 'dos/Makefile')
-rw-r--r-- | dos/Makefile | 211 |
1 files changed, 51 insertions, 160 deletions
diff --git a/dos/Makefile b/dos/Makefile index 0b8a088c..d67451a0 100644 --- a/dos/Makefile +++ b/dos/Makefile @@ -2,16 +2,6 @@ # # Makefile to build XZ Utils using DJGPP # -# Make flags to alter compilation: -# -# DEBUG=1 Enable assertions. Don't use this for production builds! -# You may also want to set CFLAGS="-g -O0" to disable -# optimizations. -# -# The usual CPPFLAGS and CFLAGS are supported too. -# -############################################################################### -# # Author: Lasse Collin # # This file has been put into the public domain. @@ -19,15 +9,16 @@ # ############################################################################### +# For debugging, set comment "#define NDEBUG 1" from config.h to enable +# the assert() macro, set STRIP=rem to disable stripping, and finally +# e.g. CFLAGS="-g -O0". CC = gcc -AR = ar STRIP = strip -SED = sed -RM = rm -f +CPPFLAGS = +CFLAGS = -g -Wall -Wextra -Wfatal-errors -march=i386 -mtune=i686 -O2 +LDFLAGS = -CFLAGS = -g -Wextra -Wfatal-errors -Wall -march=i386 -mtune=i686 -O2 - -# NOTE: -fgnu89-inline is needed on DJGPP 2.04 beta and GCC 4.3.2 +# NOTE: -fgnu89-inline is needed on DJGPP 2.04 beta and GCC >= 4.3.0 # because time.h uses GNU-style "extern inline". ALL_CFLAGS = -std=gnu99 -fgnu89-inline @@ -43,61 +34,46 @@ ALL_CPPFLAGS = \ -I../src/liblzma/lzma \ -I../src/liblzma/delta \ -I../src/liblzma/simple \ - -I../src/liblzma/subblock - -ALL_CPPFLAGS += -DHAVE_CONFIG_H - -ifdef DEBUG -STRIP := rem Skipping strip -else -ALL_CPPFLAGS += -DNDEBUG -endif + -DHAVE_CONFIG_H ALL_CPPFLAGS += $(CPPFLAGS) ALL_CFLAGS += $(CFLAGS) +.PHONY: all +all: xz.exe -################ -# Common rules # -################ - -.PHONY: all clean -all: liblzma.a getopt.a xzdec.exe lzmadec.exe xz.exe -clean: liblzma-clean getopt-clean xzdec-clean xz-clean - - -############# -# liblzma.a # -############# - -LIBLZMA_SRCS_C = \ +SRCS_C = \ + ../lib/getopt.c \ + ../lib/getopt1.c \ + ../src/common/tuklib_cpucores.c \ + ../src/common/tuklib_exit.c \ + ../src/common/tuklib_mbstr_fw.c \ + ../src/common/tuklib_mbstr_width.c \ + ../src/common/tuklib_open_stdxxx.c \ + ../src/common/tuklib_physmem.c \ + ../src/common/tuklib_progname.c \ + ../src/liblzma/check/check.c \ + ../src/liblzma/check/crc32_table.c \ + ../src/liblzma/check/crc64_table.c \ + ../src/liblzma/check/sha256.c \ ../src/liblzma/common/alone_decoder.c \ ../src/liblzma/common/alone_encoder.c \ - ../src/liblzma/common/auto_decoder.c \ - ../src/liblzma/common/block_buffer_decoder.c \ - ../src/liblzma/common/block_buffer_encoder.c \ ../src/liblzma/common/block_decoder.c \ ../src/liblzma/common/block_encoder.c \ ../src/liblzma/common/block_header_decoder.c \ ../src/liblzma/common/block_header_encoder.c \ ../src/liblzma/common/block_util.c \ ../src/liblzma/common/common.c \ - ../src/liblzma/common/easy_buffer_encoder.c \ - ../src/liblzma/common/easy_decoder_memusage.c \ - ../src/liblzma/common/easy_encoder.c \ - ../src/liblzma/common/easy_encoder_memusage.c \ - ../src/liblzma/common/easy_preset.c \ ../src/liblzma/common/filter_common.c \ ../src/liblzma/common/filter_decoder.c \ ../src/liblzma/common/filter_encoder.c \ ../src/liblzma/common/filter_flags_decoder.c \ ../src/liblzma/common/filter_flags_encoder.c \ + ../src/liblzma/common/hardware_physmem.c \ ../src/liblzma/common/index.c \ ../src/liblzma/common/index_decoder.c \ ../src/liblzma/common/index_encoder.c \ ../src/liblzma/common/index_hash.c \ - ../src/liblzma/common/stream_buffer_decoder.c \ - ../src/liblzma/common/stream_buffer_encoder.c \ ../src/liblzma/common/stream_decoder.c \ ../src/liblzma/common/stream_encoder.c \ ../src/liblzma/common/stream_flags_common.c \ @@ -106,11 +82,9 @@ LIBLZMA_SRCS_C = \ ../src/liblzma/common/vli_decoder.c \ ../src/liblzma/common/vli_encoder.c \ ../src/liblzma/common/vli_size.c \ - ../src/liblzma/check/check.c \ - ../src/liblzma/check/crc32_table.c \ - ../src/liblzma/check/crc64_table.c \ - ../src/liblzma/check/sha256.c \ - ../src/liblzma/rangecoder/price_table.c \ + ../src/liblzma/delta/delta_common.c \ + ../src/liblzma/delta/delta_decoder.c \ + ../src/liblzma/delta/delta_encoder.c \ ../src/liblzma/lz/lz_decoder.c \ ../src/liblzma/lz/lz_encoder.c \ ../src/liblzma/lz/lz_encoder_mf.c \ @@ -122,9 +96,7 @@ LIBLZMA_SRCS_C = \ ../src/liblzma/lzma/lzma_encoder_optimum_fast.c \ ../src/liblzma/lzma/lzma_encoder_optimum_normal.c \ ../src/liblzma/lzma/lzma_encoder_presets.c \ - ../src/liblzma/delta/delta_common.c \ - ../src/liblzma/delta/delta_decoder.c \ - ../src/liblzma/delta/delta_encoder.c \ + ../src/liblzma/rangecoder/price_table.c \ ../src/liblzma/simple/arm.c \ ../src/liblzma/simple/armthumb.c \ ../src/liblzma/simple/ia64.c \ @@ -133,123 +105,42 @@ LIBLZMA_SRCS_C = \ ../src/liblzma/simple/simple_decoder.c \ ../src/liblzma/simple/simple_encoder.c \ ../src/liblzma/simple/sparc.c \ - ../src/liblzma/simple/x86.c - -LIBLZMA_SRCS_ASM = \ - ../src/liblzma/check/crc32_x86.S \ - ../src/liblzma/check/crc64_x86.S - -LIBLZMA_OBJS_C = $(LIBLZMA_SRCS_C:.c=.o) -LIBLZMA_OBJS_ASM = $(LIBLZMA_SRCS_ASM:.S=.o) -LIBLZMA_OBJS = $(LIBLZMA_OBJS_C) $(LIBLZMA_OBJS_ASM) - -$(LIBLZMA_OBJS_C): %.o: %.c - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< - -$(LIBLZMA_OBJS_ASM): %.o: %.S - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< - -liblzma.a: $(LIBLZMA_OBJS) - $(RM) $@ - $(AR) rcs $@ $(LIBLZMA_OBJS) - $(STRIP) --strip-unneeded $@ - -# Avoid too long command lines. -.PHONY: liblzma-clean $(LIBLZMA_OBJS:.o=-clean) -liblzma-clean: $(LIBLZMA_OBJS:.o=-clean) - -$(RM) liblzma.a - -$(LIBLZMA_OBJS:.o=-clean): - -$(RM) $(@:-clean=.o) - - -############### -# getopt_long # -############### - -GETOPT_SRCS = \ - ../lib/getopt.c \ - ../lib/getopt1.c - -GETOPT_OBJS = $(GETOPT_SRCS:.c=.o) - -GETOPT_H = ../lib/getopt.h - -$(GETOPT_H): %.h: %.in.h - $(SED) "" $< > $@ - -$(GETOPT_OBJS): %.o: %.c $(GETOPT_H) - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< - -getopt.a: $(GETOPT_OBJS) - $(RM) $@ - $(AR) rcs $@ $(GETOPT_OBJS) - $(STRIP) --strip-unneeded $@ - -getopt-clean: - $(RM) $(GETOPT_H) $(GETOPT_OBJS) getopt.a - - -########################### -# xzdec.exe & lzmadec.exe # -########################### - -XZDEC_SRCS = ../src/xzdec/xzdec.c - -xzdec.exe: getopt.a liblzma.a $(XZDEC_SRCS) - $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(XZDEC_SRCS) -o $@ getopt.a liblzma.a - $(STRIP) --strip-all $@ - exe2coff $@ - $(RM) $@ - copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@ - $(RM) $(@:.exe=) - -lzmadec.exe: getopt.a liblzma.a $(XZDEC_SRCS) - $(CC) $(ALL_CPPFLAGS) -DLZMADEC $(ALL_CFLAGS) $(XZDEC_SRCS) -o $@ getopt.a liblzma.a - $(STRIP) --strip-all $@ - exe2coff $@ - $(RM) $@ - copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@ - $(RM) $(@:.exe=) - -.PHONY: xzdec-clean -xzdec-clean: - -$(RM) xzdec.exe lzmadec.exe xzdec lzmadec - - -########## -# xz.exe # -########## - -XZ_SRCS = \ + ../src/liblzma/simple/x86.c \ ../src/xz/args.c \ ../src/xz/coder.c \ ../src/xz/file_io.c \ ../src/xz/hardware.c \ + ../src/xz/list.c \ ../src/xz/main.c \ ../src/xz/message.c \ ../src/xz/options.c \ ../src/xz/signals.c \ ../src/xz/suffix.c \ ../src/xz/util.c +SRCS_ASM = \ + ../src/liblzma/check/crc32_x86.S \ + ../src/liblzma/check/crc64_x86.S + +OBJS_C = $(SRCS_C:.c=.o) +OBJS_ASM = $(SRCS_ASM:.S=.o) +OBJS = $(OBJS_C) $(OBJS_ASM) + +getopt.h: + update ../lib/getopt.in.h getopt.h -XZ_OBJS = $(XZ_SRCS:.c=.o) +$(OBJS): getopt.h -$(XZ_OBJS): %.o: %.c +$(OBJS_C): %.o: %.c $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< -xz.exe: getopt.a liblzma.a $(XZ_OBJS) - $(CC) $(ALL_CFLAGS) $(XZ_OBJS) -o $@ getopt.a liblzma.a +$(OBJS_ASM): %.o: %.S + $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< + +# Make xz.exe not depend on an external DPMI server. +xz.exe: $(OBJS) + $(CC) $(ALL_CFLAGS) $(OBJS) $(LDFLAGS) -o $@ $(STRIP) --strip-all $@ exe2coff $@ - $(RM) $@ + del $@ copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@ - $(RM) $(@:.exe=) - -# Avoid too long command lines. -.PHONY: xz-clean $(XZ_OBJS:.o=-clean) -xz-clean: $(XZ_OBJS:.o=-clean) - -$(RM) xz.exe xz - -$(XZ_OBJS:.o=-clean): - -$(RM) $(@:-clean=.o) + del $(@:.exe=) |