Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add install routine to makefile #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Compiled Object files
*.o

# Compiled Dynamic libraries
*.so
*.so.*

# Executable targets
zopfli
zopflipng
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,21 @@ LODEPNG_SRC := src/zopflipng/lodepng/lodepng.cpp src/zopflipng/lodepng/lodepng_u
ZOPFLIPNGLIB_SRC := src/zopflipng/zopflipng_lib.cc
ZOPFLIPNGBIN_SRC := src/zopflipng/zopflipng_bin.cc

.PHONY: zopfli zopflipng
LIBVER_MAJOR=1
LIBVER=1.0.1
SHARED_EXT = so
SHARED_EXT_MAJOR = $(SHARED_EXT).$(LIBVER_MAJOR)
SHARED_EXT_VER = $(SHARED_EXT).$(LIBVER)

DESTDIR?=
PREFIX ?= /usr/local
LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include


all: zopfli libzopfli

.PHONY: zopfli zopflipng libzopfli libzopflipng install clean

# Zopfli binary
zopfli:
Expand All @@ -25,7 +39,9 @@ zopfli:
# Zopfli shared library
libzopfli:
$(CC) $(ZOPFLILIB_SRC) $(CFLAGS) -fPIC -c
$(CC) $(ZOPFLILIB_OBJ) $(CFLAGS) -shared -Wl,-soname,libzopfli.so.1 -o libzopfli.so.1.0.1
$(CC) $(ZOPFLILIB_OBJ) $(CFLAGS) -shared -Wl,-soname,$@.$(SHARED_EXT_MAJOR) -o $@.$(SHARED_EXT_VER)
@ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT_MAJOR)
@ln -sf $@.$(SHARED_EXT_VER) $@.$(SHARED_EXT)

# ZopfliPNG binary
zopflipng:
Expand All @@ -40,3 +56,9 @@ libzopflipng:
# Remove all libraries and binaries
clean:
rm -f zopflipng zopfli $(ZOPFLILIB_OBJ) libzopfli*

install: libzopfli
@install -m 755 libzopfli.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/libzopfli.$(SHARED_EXT_VER)
@cp -a libzopfli.$(SHARED_EXT_MAJOR) $(DESTDIR)$(LIBDIR)
@cp -a libzopfli.$(SHARED_EXT) $(DESTDIR)$(LIBDIR)
@install -m 644 src/zopfli/zopfli.h $(DESTDIR)$(INCLUDEDIR)/zopfli/zopfli.h