2012-12-22 21:10:08 +00:00
|
|
|
VERSION = 1.0
|
2012-12-22 23:25:45 +00:00
|
|
|
DISTNAME = pixz-$(VERSION)
|
|
|
|
TARBALL = $(DISTNAME).tgz
|
2012-12-22 21:10:08 +00:00
|
|
|
|
2010-01-17 02:23:23 +00:00
|
|
|
ifneq ($(shell gcc -v 2>&1 | grep 'Apple Inc'),)
|
|
|
|
APPLE=1
|
|
|
|
endif
|
|
|
|
|
2010-10-13 03:44:29 +00:00
|
|
|
OPT = -g -O0
|
2012-11-05 06:14:59 +00:00
|
|
|
MYCFLAGS = $(patsubst %,-I%/include,$(LIBPREFIX)) $(OPT) -std=gnu99 \
|
2012-12-22 21:10:08 +00:00
|
|
|
-Wall -Wno-unknown-pragmas -DPIXZ_VERSION='"$(VERSION)"'
|
2012-11-05 06:14:59 +00:00
|
|
|
MYLDFLAGS = $(patsubst %,-L%/lib,$(LIBPREFIX)) $(OPT) -Wall
|
2012-09-18 07:10:03 +00:00
|
|
|
|
|
|
|
THREADS = -lpthread
|
|
|
|
LIBADD = $(THREADS) -llzma -larchive
|
2009-12-20 03:57:39 +00:00
|
|
|
|
2010-10-11 03:37:50 +00:00
|
|
|
CC = gcc
|
2012-11-05 06:14:59 +00:00
|
|
|
COMPILE = $(CC) $(MYCFLAGS) $(CFLAGS) -c -o
|
|
|
|
LD = $(CC) $(MYLDFLAGS) $(LDFLAGS) -o
|
|
|
|
|
|
|
|
ifdef APPLE
|
|
|
|
ifeq ($(CC),gcc)
|
|
|
|
MYLDFLAGS += -search_paths_first
|
|
|
|
endif
|
|
|
|
endif
|
2009-12-28 05:51:28 +00:00
|
|
|
|
2010-10-14 05:48:08 +00:00
|
|
|
PROGS = pixz
|
2012-12-22 21:10:08 +00:00
|
|
|
MANPAGE = pixz.1
|
2010-10-14 05:48:08 +00:00
|
|
|
COMMON = common.o endian.o cpu.o read.o write.o list.o
|
2009-12-28 05:51:28 +00:00
|
|
|
|
2010-01-13 02:30:48 +00:00
|
|
|
all: $(PROGS)
|
2009-12-28 05:51:28 +00:00
|
|
|
|
2009-12-29 06:48:51 +00:00
|
|
|
%.o: %.c pixz.h
|
2010-10-11 03:37:50 +00:00
|
|
|
$(COMPILE) $@ $<
|
2009-12-28 05:51:28 +00:00
|
|
|
|
2010-10-13 02:03:45 +00:00
|
|
|
$(PROGS): %: %.o $(COMMON)
|
2012-09-18 07:10:03 +00:00
|
|
|
$(LD) $@ $^ $(LIBADD)
|
2010-10-12 06:19:55 +00:00
|
|
|
|
2009-12-20 03:57:39 +00:00
|
|
|
clean:
|
2012-12-22 23:25:45 +00:00
|
|
|
rm -rf *.o $(PROGS) $(MANPAGE) dist
|
2012-12-22 21:10:08 +00:00
|
|
|
|
|
|
|
$(MANPAGE): pixz.1.asciidoc
|
|
|
|
a2x -a manversion=$(VERSION) -f manpage $<
|
|
|
|
|
2012-12-22 23:25:45 +00:00
|
|
|
dist:
|
|
|
|
rm -rf dist
|
|
|
|
mkdir -p dist
|
|
|
|
git archive --prefix=$(DISTNAME)/ --format=tar HEAD | tar -x -C dist
|
2009-12-20 03:57:39 +00:00
|
|
|
|
2012-12-22 23:25:45 +00:00
|
|
|
$(TARBALL): $(MANPAGE) dist
|
|
|
|
cp pixz.1 dist/$(DISTNAME)/
|
|
|
|
tar -cf $(TARBALL) -C dist $(DISTNAME)
|
|
|
|
|
|
|
|
tarball: $(TARBALL)
|
|
|
|
|
|
|
|
.PHONY: all clean tarball dist
|