Commit 4e5047ba authored by Mark Adler's avatar Mark Adler

Make the build a little more portable for non-gnu make and cc.

BSD make doesn't understand $^, and the Sun make has a problem with
$<. This avoids the automatic variables by explicitly specifying
the objects and targets. This also avoids a compiler complaint for
a #error directive by putting the message in quotes.
parent 59cf053d
......@@ -3,46 +3,57 @@ CFLAGS=-O3 -Wall -Wextra
LIBS=-lm -lpthread -lz
ZOP=deflate.o blocksplitter.o tree.o lz77.o cache.o hash.o util.o squeeze.o katajainen.o
# use gcc and gmake on Solaris
pigz: pigz.o yarn.o try.o ${ZOPFLI}deflate.o ${ZOPFLI}blocksplitter.o ${ZOPFLI}tree.o ${ZOPFLI}lz77.o ${ZOPFLI}cache.o ${ZOPFLI}hash.o ${ZOPFLI}util.o ${ZOPFLI}squeeze.o ${ZOPFLI}katajainen.o
$(CC) $(LDFLAGS) -o pigz $^ $(LIBS)
pigz: pigz.o yarn.o try.o $(ZOP)
$(CC) $(LDFLAGS) -o pigz pigz.o yarn.o try.o $(ZOP) $(LIBS)
ln -f pigz unpigz
pigz.o: pigz.c yarn.h try.h ${ZOPFLI}deflate.h ${ZOPFLI}util.h
pigz.o: pigz.c yarn.h try.h $(ZOPFLI)deflate.h $(ZOPFLI)util.h
yarn.o: yarn.c yarn.h
try.o: try.c try.h
${ZOPFLI}deflate.o: ${ZOPFLI}deflate.c ${ZOPFLI}deflate.h ${ZOPFLI}blocksplitter.h ${ZOPFLI}lz77.h ${ZOPFLI}squeeze.h ${ZOPFLI}tree.h ${ZOPFLI}zopfli.h ${ZOPFLI}cache.h ${ZOPFLI}hash.h ${ZOPFLI}util.h
deflate.o: $(ZOPFLI)deflate.c $(ZOPFLI)deflate.h $(ZOPFLI)blocksplitter.h $(ZOPFLI)lz77.h $(ZOPFLI)squeeze.h $(ZOPFLI)tree.h $(ZOPFLI)zopfli.h $(ZOPFLI)cache.h $(ZOPFLI)hash.h $(ZOPFLI)util.h
$(CC) $(CFLAGS) -c $(ZOPFLI)deflate.c
${ZOPFLI}blocksplitter.o: ${ZOPFLI}blocksplitter.c ${ZOPFLI}blocksplitter.h ${ZOPFLI}deflate.h ${ZOPFLI}lz77.h ${ZOPFLI}squeeze.h ${ZOPFLI}tree.h ${ZOPFLI}util.h ${ZOPFLI}zopfli.h ${ZOPFLI}cache.h ${ZOPFLI}hash.h
blocksplitter.o: $(ZOPFLI)blocksplitter.c $(ZOPFLI)blocksplitter.h $(ZOPFLI)deflate.h $(ZOPFLI)lz77.h $(ZOPFLI)squeeze.h $(ZOPFLI)tree.h $(ZOPFLI)util.h $(ZOPFLI)zopfli.h $(ZOPFLI)cache.h $(ZOPFLI)hash.h
$(CC) $(CFLAGS) -c $(ZOPFLI)blocksplitter.c
${ZOPFLI}tree.o: ${ZOPFLI}tree.c ${ZOPFLI}tree.h ${ZOPFLI}katajainen.h ${ZOPFLI}util.h
tree.o: $(ZOPFLI)tree.c $(ZOPFLI)tree.h $(ZOPFLI)katajainen.h $(ZOPFLI)util.h
$(CC) $(CFLAGS) -c $(ZOPFLI)tree.c
${ZOPFLI}lz77.o: ${ZOPFLI}lz77.h ${ZOPFLI}util.h ${ZOPFLI}cache.h ${ZOPFLI}hash.h ${ZOPFLI}zopfli.h
lz77.o: $(ZOPFLI)lz77.c $(ZOPFLI)lz77.h $(ZOPFLI)util.h $(ZOPFLI)cache.h $(ZOPFLI)hash.h $(ZOPFLI)zopfli.h
$(CC) $(CFLAGS) -c $(ZOPFLI)lz77.c
${ZOPFLI}cache.o: ${ZOPFLI}cache.c ${ZOPFLI}cache.h ${ZOPFLI}util.h
cache.o: $(ZOPFLI)cache.c $(ZOPFLI)cache.h $(ZOPFLI)util.h
$(CC) $(CFLAGS) -c $(ZOPFLI)cache.c
${ZOPFLI}hash.o: ${ZOPFLI}hash.c ${ZOPFLI}hash.h ${ZOPFLI}util.h
hash.o: $(ZOPFLI)hash.c $(ZOPFLI)hash.h $(ZOPFLI)util.h
$(CC) $(CFLAGS) -c $(ZOPFLI)hash.c
${ZOPFLI}util.o: ${ZOPFLI}util.c ${ZOPFLI}util.h
util.o: $(ZOPFLI)util.c $(ZOPFLI)util.h
$(CC) $(CFLAGS) -c $(ZOPFLI)util.c
${ZOPFLI}squeeze.o: ${ZOPFLI}squeeze.c ${ZOPFLI}squeeze.h ${ZOPFLI}blocksplitter.h ${ZOPFLI}deflate.h ${ZOPFLI}tree.h ${ZOPFLI}util.h ${ZOPFLI}zopfli.h ${ZOPFLI}lz77.h ${ZOPFLI}cache.h ${ZOPFLI}hash.h
squeeze.o: $(ZOPFLI)squeeze.c $(ZOPFLI)squeeze.h $(ZOPFLI)blocksplitter.h $(ZOPFLI)deflate.h $(ZOPFLI)tree.h $(ZOPFLI)util.h $(ZOPFLI)zopfli.h $(ZOPFLI)lz77.h $(ZOPFLI)cache.h $(ZOPFLI)hash.h
$(CC) $(CFLAGS) -c $(ZOPFLI)squeeze.c
${ZOPFLI}katajainen.o: ${ZOPFLI}katajainen.c ${ZOPFLI}katajainen.h
katajainen.o: $(ZOPFLI)katajainen.c $(ZOPFLI)katajainen.h
$(CC) $(CFLAGS) -c $(ZOPFLI)katajainen.c
dev: pigz pigzj pigzt pigzn
pigzj: pigzj.o yarn.o try.o
$(CC) $(LDFLAGS) -o pigzj $^ $(LIBS)
$(CC) $(LDFLAGS) -o pigzj pigzj.o yarn.o try.o $(LIBS)
pigzj.o: pigz.c yarn.h try.h
$(CC) $(CFLAGS) -DNOZOPFLI -c -o pigzj.o pigz.c
pigzt: pigzt.o yarnt.o try.o ${ZOPFLI}deflate.o ${ZOPFLI}blocksplitter.o ${ZOPFLI}tree.o ${ZOPFLI}lz77.o ${ZOPFLI}cache.o ${ZOPFLI}hash.o ${ZOPFLI}util.o ${ZOPFLI}squeeze.o ${ZOPFLI}katajainen.o
$(CC) $(LDFLAGS) -o pigzt $^ $(LIBS)
pigzt: pigzt.o yarnt.o try.o $(ZOP)
$(CC) $(LDFLAGS) -o pigzt pigzt.o yarnt.o try.o $(ZOP) $(LIBS)
pigzt.o: pigz.c yarn.h try.h
$(CC) $(CFLAGS) -DDEBUG -g -c -o pigzt.o pigz.c
......@@ -50,8 +61,8 @@ pigzt.o: pigz.c yarn.h try.h
yarnt.o: yarn.c yarn.h
$(CC) $(CFLAGS) -DDEBUG -g -c -o yarnt.o yarn.c
pigzn: pigzn.o tryn.o ${ZOPFLI}deflate.o ${ZOPFLI}blocksplitter.o ${ZOPFLI}tree.o ${ZOPFLI}lz77.o ${ZOPFLI}cache.o ${ZOPFLI}hash.o ${ZOPFLI}util.o ${ZOPFLI}squeeze.o ${ZOPFLI}katajainen.o
$(CC) $(LDFLAGS) -o pigzn $^ $(LIBS)
pigzn: pigzn.o tryn.o $(ZOP)
$(CC) $(LDFLAGS) -o pigzn pigzn.o tryn.o $(ZOP) $(LIBS)
pigzn.o: pigz.c try.h
$(CC) $(CFLAGS) -DDEBUG -DNOTHREAD -g -c -o pigzn.o pigz.c
......@@ -88,4 +99,4 @@ pigz.pdf: pigz.1
groff -mandoc -f H -T ps pigz.1 | ps2pdf - pigz.pdf
@rm -f *.o ${ZOPFLI}*.o pigz unpigz pigzj pigzn pigzt pigz.c.gz pigz.c.zz
@rm -f *.o pigz unpigz pigzj pigzn pigzt pigz.c.gz pigz.c.zz
......@@ -390,7 +390,7 @@
Z_OK, Z_SYNC_FLUSH, z_stream */
#if !defined(ZLIB_VERNUM) || ZLIB_VERNUM < 0x1230
# error Need zlib version 1.2.3 or later
# error "Need zlib version 1.2.3 or later"
#ifndef NOTHREAD
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment