xref: /freebsd/sys/contrib/xz-embedded/userspace/Makefile (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1#
2# Makefile
3#
4# Author: Lasse Collin <lasse.collin@tukaani.org>
5#
6# This file has been put into the public domain.
7# You can do whatever you want with this file.
8#
9
10CC = gcc -std=gnu89
11BCJ_CPPFLAGS = -DXZ_DEC_X86 -DXZ_DEC_POWERPC -DXZ_DEC_IA64 \
12		-DXZ_DEC_ARM -DXZ_DEC_ARMTHUMB -DXZ_DEC_SPARC
13CPPFLAGS = -DXZ_USE_CRC64 -DXZ_DEC_ANY_CHECK
14CFLAGS = -ggdb3 -O2 -pedantic -Wall -Wextra
15RM = rm -f
16VPATH = ../linux/include/linux ../linux/lib/xz
17COMMON_SRCS = xz_crc32.c xz_crc64.c xz_dec_stream.c xz_dec_lzma2.c xz_dec_bcj.c
18COMMON_OBJS = $(COMMON_SRCS:.c=.o)
19XZMINIDEC_OBJS = xzminidec.o
20BYTETEST_OBJS = bytetest.o
21BUFTEST_OBJS = buftest.o
22BOOTTEST_OBJS = boottest.o
23XZ_HEADERS = xz.h xz_private.h xz_stream.h xz_lzma2.h xz_config.h
24PROGRAMS = xzminidec bytetest buftest boottest
25
26ALL_CPPFLAGS = -I../linux/include/linux -I. $(BCJ_CPPFLAGS) $(CPPFLAGS)
27
28all: $(PROGRAMS)
29
30%.o: %.c $(XZ_HEADERS)
31	$(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c -o $@ $<
32
33xzminidec: $(COMMON_OBJS) $(XZMINIDEC_OBJS)
34	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(XZMINIDEC_OBJS)
35
36bytetest: $(COMMON_OBJS) $(BYTETEST_OBJS)
37	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(BYTETEST_OBJS)
38
39buftest: $(COMMON_OBJS) $(BUFTEST_OBJS)
40	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(COMMON_OBJS) $(BUFTEST_OBJS)
41
42boottest: $(BOOTTEST_OBJS) $(COMMON_SRCS)
43	$(CC) $(ALL_CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(BOOTTEST_OBJS)
44
45.PHONY: clean
46clean:
47	-$(RM) $(COMMON_OBJS) $(XZMINIDEC_OBJS) $(BUFTEST_OBJS) \
48		$(BOOTTEST_OBJS) $(PROGRAMS)
49