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

Switch from Autoconf to plain Make #290

Open
wants to merge 1 commit 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
27 changes: 1 addition & 26 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,48 +7,23 @@
*.zip
*~
.DS_Store
.deps
ABOUT-NLS
Makefile
Makefile.in
Makefile.in.in
aclocal.m4
autom4te.cache
ar-lib
compile
config.*
configure
data/spek.desktop
data/spek.metainfo.xml
depcomp
dist/osx/Info.plist
dist/osx/Spek.app
dist/osx/Spek.dmg
dist/win/Spek
dist/win/spek.wxs
dist/win/tests
env
install-sh
libtool
ltmain.sh
m4/
man/spek.1
missing
mkinstalldirs
omf.make
po/*.header
po/*.gmo
po/*.sed
po/*.sin
po/*.template
po/POTFILES
po/Rules-quot
po/stamp-it
po/stamp-po
spek
src/*.stamp
src/.libs
src/spek
stamp-h1
tests/.libs
tests/perf
tests/samples/perf.wav
Expand Down
232 changes: 232 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
NAME = spek
BIN = ${NAME}${EXT}
LIB = lib${NAME}.a
VERSION = 0.8.5

PREFIX = /usr/local

LIBS = -lavcodec -lavformat -lavutil `wx-config --libs`

TESTS_LIBS = -lavcodec -lavformat -lavutil

TESTS_CPPFLAGS = -DSAMPLES_DIR=\"samples\" -Isrc -pthread ${CPPFLAGS}
TESTS_CXXFLAGS = -Os ${TESTS_CPPFLAGS} ${CXXFLAGS}
TESTS_LDFLAGS = -pthread ${TESTS_LIBS} ${LDFLAGS}

SPEK_CPPFLAGS = ${OS_FLAGS} -DGETTEXT_PACKAGE=\"'${NAME}'\" -DPACKAGE_NAME=\"'${NAME}'\" -DPACKAGE_VERSION=\"'${VERSION}'\" `wx-config --cppflags` ${CPPFLAGS}
SPEK_CXXFLAGS = -Os `wx-config --cxxflags` ${SPEK_CPPFLAGS} ${CXXFLAGS}
SPEK_LDFLAGS = ${LIBS} ${LDFLAGS}

GMO = ${PO:.po=.gmo}

OBJ_LIB = \
src/spek-audio.o \
src/spek-fft.o \
src/spek-palette.o \
src/spek-pipeline.o \
src/spek-utils.o \

OBJ_PERF = \
tests/perf.o \

OBJ_TEST = \
tests/test-audio.o \
tests/test-fft.o \
tests/test-utils.o \
tests/test.o \

OBJ = \
src/spek-artwork.o \
src/spek-events.o \
src/spek.o \
src/spek-platform.o \
src/spek-preferences-dialog.o \
src/spek-preferences.o \
src/spek-ruler.o \
src/spek-spectrogram.o \
src/spek-window.o \

PO = \
po/bs.po \
po/ca.po \
po/cs.po \
po/da.po \
po/de.po \
po/el.po \
po/eo.po \
po/es.po \
po/fi.po \
po/fr.po \
po/gl.po \
po/he.po \
po/hr.po \
po/hu.po \
po/id.po \
po/it.po \
po/ja.po \
po/ko.po \
po/lv.po \
po/nb.po \
po/nl.po \
po/nn.po \
po/pl.po \
po/pt_BR.po \
po/ru.po \
po/sk.po \
po/sr@latin.po \
po/sv.po \
po/th.po \
po/tr.po \
po/uk.po \
po/vi.po \
po/zh_CN.po \
po/zh_TW.po \

POTFILES = \
data/spek.desktop.in \
src/spek-pipeline.cc \
src/spek-preferences-dialog.cc \
src/spek-spectrogram.cc \
src/spek-window.cc \
src/spek.cc \

all:
@echo "To build ${NAME} type make and one the following: osx, unix or win."
@echo "E.g. \`make unix\`"

options:
@echo "${NAME} build options:"
@echo "CXXFLAGS = ${SPEK_CXXFLAGS}"
@echo "LDFLAGS = ${SPEK_LDFLAGS}"
@echo "CXX = ${CXX}"

.cc.o:
${CXX} -c ${SPEK_CXXFLAGS} $< -o $@

.po.gmo:
msgfmt -o $@ $<

${LIB}: ${OBJ_LIB}
ar crs $@ ${OBJ_LIB}

${BIN}: ${LIB} ${OBJ}
${CXX} -o ${BIN} ${OBJ} ${LIB} ${SPEK_LDFLAGS}

data/${NAME}.desktop: po/LINGUAS
sed '/^#/d' ${@}.in > ${@}.in.tmp
msgfmt -d po -o $@ --desktop --template=${@}.in.tmp
rm ${@}.in.tmp

data/${NAME}.metainfo.xml: po/LINGUAS
msgfmt -d po -o $@ --xml --template=${@}.in

po/LINGUAS: ${PO}
printf "%s" '${PO}' | xargs -d ' ' -I {} printf "%s\n" '{}' | sed 's/^po\/\(.*\)\.po$$/\1/' | sort > $@

po/${NAME}.pot: ${POTFILES}
xgettext -o $@ --copyright-holder='The Spek authors' --package-name=${NAME} --package-version=${VERSION} --from-code=UTF-8 --add-comments --keyword=_ --keyword=N_ ${POTFILES}
for po in po/*.po; do \
msgmerge -o "$$po" -q "$$po" $@; \
done;

osx:
@make options ${BIN} OS_FLAGS=-DOS_OSX

unix:
@make options ${BIN} OS_FLAGS=-DOS_UNIX

win:
@make options ${NAME}.exe EXT=.exe OS_FLAGS=-DOS_WIN

${OBJ_PERF} ${OBJ_TEST}:
${CXX} -c ${TESTS_CXXFLAGS} ${@:.o=.cc} -o $@

tests/perf${EXT}: ${LIB} ${OBJ_PERF}
${CXX} -o $@ ${OBJ_PERF} ${LIB} ${TESTS_LDFLAGS}

tests/test${EXT}: ${LIB} ${OBJ_TEST}
${CXX} -o $@ ${OBJ_TEST} ${LIB} ${TESTS_LDFLAGS}

check: tests/perf${EXT} tests/test${EXT}
cd tests && ./test${EXT} && ./perf${EXT}

clean:
rm -f ${BIN} ${NAME}.exe ${LIB} ${OBJ} ${OBJ_LIB} ${GMO} data/${NAME}.desktop data/${NAME}.desktop.in.tmp data/${NAME}.metainfo.xml ${NAME}-${VERSION}.tar.gz tests/perf tests/perf.exe tests/perf${EXT} tests/test tests/test.exe tests/test${EXT} ${OBJ_PERF} ${OBJ_TEST}

dist: clean po/${NAME}.pot
mkdir ${NAME}-${VERSION}
cp -R $$(ls -A | sed '/^\.git$$/d;/^${NAME}-${VERSION}$$/d') ${NAME}-${VERSION}
tar -cf ${NAME}-${VERSION}.tar ${NAME}-${VERSION}
gzip ${NAME}-${VERSION}.tar
rm -fr ${NAME}-${VERSION}

install: data/${NAME}.metainfo.xml ${BIN} data/${NAME}.desktop ${GMO}
# appstream file
mkdir -p ${DESTDIR}${PREFIX}/share/metainfo
cp -f data/${NAME}.metainfo.xml ${DESTDIR}${PREFIX}/share/metainfo
chmod 644 ${DESTDIR}${PREFIX}/share/metainfo/${NAME}.metainfo.xml
# bin
mkdir -p ${DESTDIR}${PREFIX}/bin
cp -f ${BIN} ${DESTDIR}${PREFIX}/bin
chmod 755 ${DESTDIR}${PREFIX}/bin/${BIN}
# desktop
mkdir -p ${DESTDIR}${PREFIX}/share/applications
cp -f data/${NAME}.desktop ${DESTDIR}${PREFIX}/share/applications
chmod 644 ${DESTDIR}${PREFIX}/share/applications/${NAME}.desktop
# doc
mkdir -p ${DESTDIR}${PREFIX}/share/doc/${NAME}
cp -f CREDITS.md ${DESTDIR}${PREFIX}/share/doc/${NAME}
chmod 644 ${DESTDIR}${PREFIX}/share/doc/${NAME}/CREDITS.md
cp -f LICENSE ${DESTDIR}${PREFIX}/share/doc/${NAME}
chmod 644 ${DESTDIR}${PREFIX}/share/doc/${NAME}/LICENSE
cp -f MANUAL.md ${DESTDIR}${PREFIX}/share/doc/${NAME}
chmod 644 ${DESTDIR}${PREFIX}/share/doc/${NAME}/MANUAL.md
cp -f README.md ${DESTDIR}${PREFIX}/share/doc/${NAME}
chmod 644 ${DESTDIR}${PREFIX}/share/doc/${NAME}/README.md
# icons
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/16x16/apps
cp -f data/icons/16x16/${NAME}.png ${DESTDIR}${PREFIX}/share/icons/hicolor/16x16/apps
chmod 644 ${DESTDIR}${PREFIX}/share/icons/hicolor/16x16/apps/${NAME}.png
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/22x22/apps
cp -f data/icons/22x22/${NAME}.png ${DESTDIR}${PREFIX}/share/icons/hicolor/22x22/apps
chmod 644 ${DESTDIR}${PREFIX}/share/icons/hicolor/22x22/apps/${NAME}.png
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/24x24/apps
cp -f data/icons/24x24/${NAME}.png ${DESTDIR}${PREFIX}/share/icons/hicolor/24x24/apps
chmod 644 ${DESTDIR}${PREFIX}/share/icons/hicolor/24x24/apps/${NAME}.png
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/32x32/apps
cp -f data/icons/32x32/${NAME}.png ${DESTDIR}${PREFIX}/share/icons/hicolor/32x32/apps
chmod 644 ${DESTDIR}${PREFIX}/share/icons/hicolor/32x32/apps/${NAME}.png
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/48x48/apps
cp -f data/icons/48x48/${NAME}.png ${DESTDIR}${PREFIX}/share/icons/hicolor/48x48/apps
chmod 644 ${DESTDIR}${PREFIX}/share/icons/hicolor/48x48/apps/${NAME}.png
mkdir -p ${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps
cp -f data/icons/scalable/${NAME}.svg ${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps
chmod 644 ${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/${NAME}.svg
# locale
for gmo in po/*.gmo; do \
dir="$$(echo $$gmo | sed 's/^po\/\(.*\)\.gmo$$/\1/')"; \
mkdir -p ${DESTDIR}${PREFIX}/share/locale/$${dir}/LC_MESSAGES; \
cp -f $$gmo ${DESTDIR}${PREFIX}/share/locale/$${dir}/LC_MESSAGES/${NAME}.mo; \
chmod 644 ${DESTDIR}${PREFIX}/share/locale/$${dir}/LC_MESSAGES/${NAME}.mo; \
done;
# man
mkdir -p ${DESTDIR}${PREFIX}/share/man/man1
cp -f man/${NAME}.1 ${DESTDIR}${PREFIX}/share/man/man1
chmod 644 ${DESTDIR}${PREFIX}/share/man/man1/${NAME}.1

uninstall:
rm -f ${DESTDIR}${PREFIX}/share/metainfo/${NAME}.metainfo.xml
rm -f ${DESTDIR}${PREFIX}/bin/${BIN}
rm -f ${DESTDIR}${PREFIX}/share/applications/${NAME}.desktop
rm -fr ${DESTDIR}${PREFIX}/share/doc/${NAME}
rm -f ${DESTDIR}${PREFIX}/share/icons/hicolor/16x16/apps/${NAME}.png
rm -f ${DESTDIR}${PREFIX}/share/icons/hicolor/22x22/apps/${NAME}.png
rm -f ${DESTDIR}${PREFIX}/share/icons/hicolor/24x24/apps/${NAME}.png
rm -f ${DESTDIR}${PREFIX}/share/icons/hicolor/32x32/apps/${NAME}.png
rm -f ${DESTDIR}${PREFIX}/share/icons/hicolor/48x48/apps/${NAME}.png
rm -f ${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/${NAME}.svg
find ${DESTDIR}${PREFIX} -path '${DESTDIR}${PREFIX}/share/locale/*/LC_MESSAGES/${NAME}.mo' -exec rm -f {} \;
rm -f ${DESTDIR}${PREFIX}/share/man/man1/${NAME}.1

.PHONY: all options osx unix win check clean install uninstall
.SUFFIXES: .po .gmo
44 changes: 0 additions & 44 deletions Makefile.am

This file was deleted.

11 changes: 0 additions & 11 deletions autogen.sh

This file was deleted.

Loading