-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
autotools suck. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
- Loading branch information
Showing
9 changed files
with
89 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
CC := gcc | ||
CXX := g++ | ||
|
||
CPPFLAGS := -ggdb -Wall -Wextra -Wno-unused-parameter | ||
|
||
TAGLIB_CPPFLAGS := $(shell pkg-config --cflags taglib) | ||
TAGLIB_LIBS := $(shell pkg-config --libs taglib) | ||
|
||
prefix := /usr | ||
version := $(shell ./get-version) | ||
|
||
all: | ||
|
||
libmtag.so: lib/mtag.o | ||
libmtag.so: CPPFLAGS := $(CPPFLAGS) $(TAGLIB_CPPFLAGS) -I./lib | ||
libmtag.so: LIBS := $(LIBS) $(TAGLIB_LIBS) | ||
libmtag.so: LDFLAGS := $(LDFLAGS) -Wl,-soname,libmtag.so.0 | ||
|
||
mtag: src/mtag.o | libmtag.so | ||
mtag: CPPFLAGS := $(CPPFLAGS) -I./lib | ||
mtag: LIBS := $(LIBS) -L./ -lmtag | ||
binaries += mtag | ||
|
||
tests/reader: tests/reader.o | libmtag.so | ||
tests/reader: CPPFLAGS := $(CPPFLAGS) -I./lib | ||
tests/reader: LIBS := $(LIBS) -L./ -lmtag | ||
binaries += tests/reader | ||
|
||
all: libmtag.so $(binaries) | ||
|
||
libmtag.pc: libmtag.pc.in | ||
sed -e 's#@prefix@#$(prefix)#g' -e 's#@version@#$(version)#g' $< > $@ | ||
|
||
D = $(DESTDIR) | ||
|
||
install: libmtag.so libmtag.pc | ||
mkdir -p $(D)/$(prefix)/lib | ||
install -m 755 libmtag.so $(D)/$(prefix)/lib/libmtag.so.0 | ||
ln -sf libmtag.so.0 $(D)/$(prefix)/lib/libmtag.so | ||
mkdir -p $(D)/$(prefix)/include/libmtag | ||
install -m 644 lib/mtag.h $(D)/$(prefix)/include/libmtag | ||
mkdir -p $(D)/$(prefix)/lib/pkgconfig | ||
install -m 644 libmtag.pc $(D)/$(prefix)/lib/pkgconfig/libmtag.pc | ||
|
||
dist: base := libmtag-$(version) | ||
dist: | ||
git archive --format=tar --prefix=$(base)/ HEAD > /tmp/$(base).tar | ||
mkdir -p $(base) | ||
echo $(version) > $(base)/.version | ||
chmod 664 $(base)/.version | ||
tar --append -f /tmp/$(base).tar --owner root --group root $(base)/.version | ||
rm -r $(base) | ||
gzip /tmp/$(base).tar | ||
|
||
# pretty print | ||
V = @ | ||
Q = $(V:y=) | ||
QUIET_CC = $(Q:@=@echo ' CC '$@;) | ||
QUIET_CXX = $(Q:@=@echo ' CXX '$@;) | ||
QUIET_LINK = $(Q:@=@echo ' LINK '$@;) | ||
QUIET_CLEAN = $(Q:@=@echo ' CLEAN '$@;) | ||
|
||
%.so:: | ||
$(QUIET_LINK)$(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) | ||
|
||
$(binaries): | ||
$(QUIET_LINK)$(CC) $(LDFLAGS) $(LIBS) -o $@ $^ | ||
|
||
%.o:: %.cpp | ||
$(QUIET_CXX)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -o $@ -c $< | ||
|
||
%.o:: %.c | ||
$(QUIET_CC)$(CC) $(CPPFLAGS) $(CFLAGS) -MMD -o $@ -c $< | ||
|
||
clean: | ||
$(QUIET_CLEAN)$(RM) $(binaries) `find -name '[*.oad]'` | ||
|
||
-include lib/*.d src/*.d tests/*.d |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
if test -f .version | ||
then | ||
cat .version | ||
else | ||
git describe --tags | sed 's/^v//' | ||
fi |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
prefix=@prefix@ | ||
exec_prefix=@exec_prefix@ | ||
libdir=@libdir@ | ||
includedir=@includedir@ | ||
libdir=${prefix}/lib | ||
includedir=${prefix}/include | ||
|
||
Name: libmtag | ||
Description: Music tagging library | ||
Version: @VERSION@ | ||
Version: @version@ | ||
Libs: -L${libdir} -lmtag | ||
Cflags: -I${includedir}/libmtag |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.