Removed what I believe is an incorrect #ifdef HAVE_* test.
[icculus/xz.git] / dos / Makefile
1 ###############################################################################
2 #
3 # Makefile to build XZ Utils using DJGPP
4 #
5 # Author: Lasse Collin
6 #
7 # This file has been put into the public domain.
8 # You can do whatever you want with this file.
9 #
10 ###############################################################################
11
12 # For debugging, set comment "#define NDEBUG 1" from config.h to enable
13 # the assert() macro, set STRIP=rem to disable stripping, and finally
14 # e.g. CFLAGS="-g -O0".
15 CC = gcc
16 STRIP = strip
17 CPPFLAGS =
18 CFLAGS = -g -Wall -Wextra -Wfatal-errors -march=i386 -mtune=i686 -O2
19 LDFLAGS =
20
21 # NOTE: -fgnu89-inline is needed on DJGPP 2.04 beta and GCC >= 4.3.0
22 # because time.h uses GNU-style "extern inline".
23 ALL_CFLAGS = -std=gnu99 -fgnu89-inline
24
25 ALL_CPPFLAGS = \
26         -I. \
27         -I../lib \
28         -I../src/common \
29         -I../src/liblzma/api \
30         -I../src/liblzma/common \
31         -I../src/liblzma/check \
32         -I../src/liblzma/rangecoder \
33         -I../src/liblzma/lz \
34         -I../src/liblzma/lzma \
35         -I../src/liblzma/delta \
36         -I../src/liblzma/simple \
37         -DHAVE_CONFIG_H
38
39 ALL_CPPFLAGS += $(CPPFLAGS)
40 ALL_CFLAGS += $(CFLAGS)
41
42 .PHONY: all
43 all: xz.exe
44
45 SRCS_C = \
46         ../lib/getopt.c \
47         ../lib/getopt1.c \
48         ../src/common/tuklib_cpucores.c \
49         ../src/common/tuklib_exit.c \
50         ../src/common/tuklib_mbstr_fw.c \
51         ../src/common/tuklib_mbstr_width.c \
52         ../src/common/tuklib_open_stdxxx.c \
53         ../src/common/tuklib_physmem.c \
54         ../src/common/tuklib_progname.c \
55         ../src/liblzma/check/check.c \
56         ../src/liblzma/check/crc32_table.c \
57         ../src/liblzma/check/crc64_table.c \
58         ../src/liblzma/check/sha256.c \
59         ../src/liblzma/common/alone_decoder.c \
60         ../src/liblzma/common/alone_encoder.c \
61         ../src/liblzma/common/block_decoder.c \
62         ../src/liblzma/common/block_encoder.c \
63         ../src/liblzma/common/block_header_decoder.c \
64         ../src/liblzma/common/block_header_encoder.c \
65         ../src/liblzma/common/block_util.c \
66         ../src/liblzma/common/common.c \
67         ../src/liblzma/common/filter_common.c \
68         ../src/liblzma/common/filter_decoder.c \
69         ../src/liblzma/common/filter_encoder.c \
70         ../src/liblzma/common/filter_flags_decoder.c \
71         ../src/liblzma/common/filter_flags_encoder.c \
72         ../src/liblzma/common/hardware_physmem.c \
73         ../src/liblzma/common/index.c \
74         ../src/liblzma/common/index_decoder.c \
75         ../src/liblzma/common/index_encoder.c \
76         ../src/liblzma/common/index_hash.c \
77         ../src/liblzma/common/stream_decoder.c \
78         ../src/liblzma/common/stream_encoder.c \
79         ../src/liblzma/common/stream_flags_common.c \
80         ../src/liblzma/common/stream_flags_decoder.c \
81         ../src/liblzma/common/stream_flags_encoder.c \
82         ../src/liblzma/common/vli_decoder.c \
83         ../src/liblzma/common/vli_encoder.c \
84         ../src/liblzma/common/vli_size.c \
85         ../src/liblzma/delta/delta_common.c \
86         ../src/liblzma/delta/delta_decoder.c \
87         ../src/liblzma/delta/delta_encoder.c \
88         ../src/liblzma/lz/lz_decoder.c \
89         ../src/liblzma/lz/lz_encoder.c \
90         ../src/liblzma/lz/lz_encoder_mf.c \
91         ../src/liblzma/lzma/fastpos_table.c \
92         ../src/liblzma/lzma/lzma2_decoder.c \
93         ../src/liblzma/lzma/lzma2_encoder.c \
94         ../src/liblzma/lzma/lzma_decoder.c \
95         ../src/liblzma/lzma/lzma_encoder.c \
96         ../src/liblzma/lzma/lzma_encoder_optimum_fast.c \
97         ../src/liblzma/lzma/lzma_encoder_optimum_normal.c \
98         ../src/liblzma/lzma/lzma_encoder_presets.c \
99         ../src/liblzma/rangecoder/price_table.c \
100         ../src/liblzma/simple/arm.c \
101         ../src/liblzma/simple/armthumb.c \
102         ../src/liblzma/simple/ia64.c \
103         ../src/liblzma/simple/powerpc.c \
104         ../src/liblzma/simple/simple_coder.c \
105         ../src/liblzma/simple/simple_decoder.c \
106         ../src/liblzma/simple/simple_encoder.c \
107         ../src/liblzma/simple/sparc.c \
108         ../src/liblzma/simple/x86.c \
109         ../src/xz/args.c \
110         ../src/xz/coder.c \
111         ../src/xz/file_io.c \
112         ../src/xz/hardware.c \
113         ../src/xz/list.c \
114         ../src/xz/main.c \
115         ../src/xz/message.c \
116         ../src/xz/options.c \
117         ../src/xz/signals.c \
118         ../src/xz/suffix.c \
119         ../src/xz/util.c
120 SRCS_ASM = \
121         ../src/liblzma/check/crc32_x86.S \
122         ../src/liblzma/check/crc64_x86.S
123
124 OBJS_C = $(SRCS_C:.c=.o)
125 OBJS_ASM = $(SRCS_ASM:.S=.o)
126 OBJS = $(OBJS_C) $(OBJS_ASM)
127
128 getopt.h:
129         update ../lib/getopt.in.h getopt.h
130
131 $(OBJS): getopt.h
132
133 $(OBJS_C): %.o: %.c
134         $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $<
135
136 $(OBJS_ASM): %.o: %.S
137         $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $<
138
139 # Make xz.exe not depend on an external DPMI server.
140 xz.exe: $(OBJS)
141         $(CC) $(ALL_CFLAGS) $(OBJS) $(LDFLAGS) -o $@
142         $(STRIP) --strip-all $@
143         exe2coff $@
144         del $@
145         copy /b $(DJGPP:DJGPP.ENV=BIN\CWSDSTUB.EXE) + $(@:.exe=) $@
146         del $(@:.exe=)