Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ stb_image.h
stb_image_write.h
qoibench
qoiconv
qoi.pc
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ LFLAGS_CONV ?= $(LDFLAGS)
TARGET_BENCH ?= qoibench
TARGET_CONV ?= qoiconv

PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
INCLUDEDIR ?= $(PREFIX)/include
DATAROOTDIR ?= $(PREFIX)/share

all: $(TARGET_BENCH) $(TARGET_CONV)

bench: $(TARGET_BENCH)
Expand All @@ -17,6 +22,24 @@ conv: $(TARGET_CONV)
$(TARGET_CONV):$(TARGET_CONV).c qoi.h
$(CC) $(CFLAGS_CONV) $(CFLAGS) $(TARGET_CONV).c -o $(TARGET_CONV) $(LFLAGS_CONV)

qoi.pc: qoi.pc.in
sed < qoi.pc.in > qoi.pc \
-e 's|@PREFIX@|$(PREFIX)|g' \
-e 's|@INCLUDEDIR@|$(INCLUDEDIR:$(PREFIX)%=$${prefix}%)|g'

.PHONY: install
install: install-tools install-header

.PHONY: install-tools
install-tools: all
install -Dm 755 $(TARGET_CONV) $(DESTDIR)$(BINDIR)/$(TARGET_CONV)
install -Dm 755 $(TARGET_BENCH) $(DESTDIR)$(BINDIR)/$(TARGET_BENCH)

.PHONY: install-header
install-header: qoi.h qoi.pc
install -Dm 644 qoi.h $(DESTDIR)$(INCLUDEDIR)/qoi.h
install -Dm 644 qoi.pc $(DESTDIR)$(DATAROOTDIR)/pkgconfig/qoi.pc

.PHONY: clean
clean:
$(RM) $(TARGET_BENCH) $(TARGET_CONV)
9 changes: 9 additions & 0 deletions qoi.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prefix=@PREFIX@
includedir=@INCLUDEDIR@

Name: qoi
Description: The "Quite OK Image Format" for fast, lossless image compression
Version: 0
URL: https://qoiformat.org/
License: MIT
Cflags: -I${includedir}