aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile153
1 files changed, 153 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..00b2988
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,153 @@
+# configuration
+-include Make.config
+include mk/Variables.mk
+
+# QT/KDE dirs
+ifeq ($(QTDIR),)
+QTDIR := /usr
+foobar := $(shell echo "WARNING: QTDIR isn't set, assuming /usr" >&2)
+endif
+ifeq ($(KDEDIR),)
+KDEDIR := /usr
+foobar := $(shell echo "WARNING: KDEDIR isn't set, assuming /usr" >&2)
+endif
+prefix := $(KDEDIR)
+export QTDIR KDEDIR
+
+# kde install directories
+appsdir := $(DESTDIR)$(shell sh kdedirs apps)/Multimedia
+datadir := $(DESTDIR)$(shell sh kdedirs data)/krecord
+htmldir := $(DESTDIR)$(shell sh kdedirs html)/en/krecord
+
+# default target
+all: build
+
+
+##########################################################################
+# fixup flags depending on the environment variables (QTDIR, KDEDIR)
+
+# X11R6
+X11DIR := /usr/X11R6
+CFLAGS += -I$(X11DIR)/include
+LDFLAGS += -L$(X11DIR)/$(LIB)
+
+# Qt
+ifeq ($(QTDIR),/usr)
+CFLAGS += -I/usr/include/qt
+else
+CFLAGS += -I$(QTDIR)/include
+LDFLAGS += -L$(QTDIR)/$(LIB)
+endif
+
+# KDE
+ifeq ($(KDEDIR),/usr)
+CFLAGS += -I/usr/include/kde
+else
+CFLAGS += -I$(KDEDIR)/include
+LDFLAGS += -L$(KDEDIR)/$(LIB)
+endif
+
+# version
+CFLAGS += -DKRECORD_VERSION='"$(VERSION)"'
+CFLAGS += -fno-strict-aliasing # fft code needs this
+
+
+##########################################################################
+# poor man's autoconf
+
+include mk/Autoconf.mk
+
+define make-config
+LIB := $(LIB)
+HAVE_SOUNDCARD_H := $(call ac_header,soundcard.h)
+HAVE_SYS_SOUNDCARD_H := $(call ac_header,sys/soundcard.h)
+HAVE_SUN_AUDIOIO_H := $(call ac_header,sun/audioio.h)
+HAVE_LIBQT_MT := $(call ac_lib,qt_wm_state,qt-mt)
+endef
+
+# config conditionals
+includes := SOUNDCARD_H SYS_SOUNDCARD_H SUN_AUDIOIO_H
+inc_cflags := $(call ac_inc_cflags,$(includes))
+CFLAGS += $(inc_cflags)
+
+ifeq ($(HAVE_LIBQT_MT),yes)
+QTLIB=-lqt-mt
+else
+QTLIB=-lqt
+endif
+
+
+##########################################################################
+# my targets
+
+# krecord
+TARGET := krecord
+OBJS := krecord.o sound.o fft.o level.o buffer.o soundfft.o \
+ oss.o sunaudio.o
+SRCS := krecord.cpp sound.cpp fft.cpp level.cpp buffer.cpp soundfft.c \
+ oss.cpp sunaudio.cpp
+MOCS := krecord.moc sound.moc fft.moc level.moc buffer.moc \
+ oss.moc sunaudio.moc
+
+CXXFLAGS := $(CFLAGS)
+LDLIBS += -lkdeui -lkdecore $(QTLIB) -lXext -lXmu -lX11
+
+# locales
+PO := $(wildcard po/*.po)
+MO := $(subst .po,.mo,$(PO))
+MERGE := $(subst .po,.pox,$(PO))
+LANGS := $(patsubst po/%.po,install-lang-%,$(PO))
+
+build: $(TARGET) $(MO)
+
+$(TARGET): $(OBJS)
+
+install: install-bin $(LANGS)
+
+install-bin: $(TARGET)
+ $(INSTALL_DIR) $(bindir)
+ $(INSTALL_BINARY) $(TARGET) $(bindir)
+ $(INSTALL_DIR) $(appsdir)
+ $(INSTALL_DATA) krecord.kdelnk $(appsdir)
+ $(INSTALL_DIR) $(datadir)/toolbar
+ $(INSTALL_DATA) img/*.png $(datadir)/toolbar
+ $(INSTALL_DIR) $(htmldir)
+ $(INSTALL_DATA) index.html $(htmldir)
+
+install-lang-%: po/%.mo
+ $(INSTALL_DIR) $(locdir)/$*/LC_MESSAGES
+ $(INSTALL_DATA) $< $(locdir)/$*/LC_MESSAGES/krecord.mo
+
+clean:
+ rm -f *.o $(depfiles)
+ rm -f *.bak *~ *% core* "#*"
+ rm -f po/*~ po/*.mo
+
+realclean distclean:: clean
+ rm -f $(TARGET) $(MOCS) Make.config
+
+po/krecord.pot: $(SRCS)
+ touch messages.po
+ xgettext -sj --keyword=i18n $(SRCS)
+ mv messages.po $@
+
+locale: po/krecord.pot $(MERGE)
+
+
+##########################################################################
+# some rules
+
+%.pox : %.po po/krecord.pot
+ msgmerge $< po/krecord.pot > $@
+
+buffer.o: buffer.moc
+fft.o: fft.moc
+krecord.o: krecord.moc
+level.o: level.moc
+oss.o: oss.moc
+sound.o: sound.moc
+sunaudio.o: sunaudio.moc
+
+include mk/Compile.mk
+include mk/Maintainer.mk
+-include $(depfiles)