
# --- GSMP-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the GSMP-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# GSMP: pcm/src/Makefile
# General Sound Manipulation Program is Copyright (C) 2000 - 2004
#   Valentin Ziegler and Ren Rebe
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2. A copy of the GNU General
# Public License can be found in the file LICENSE.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT-
# ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
# 
# --- GSMP-COPYRIGHT-NOTE-END ---

TOPDIR  = ..

NOT_SRCS := netconf_applet.cc interface_combo.cc
NOT_MOCS := netconf_applet.hh interface_combo.hh device_manager.hh device_factory.hh pixmaps.hh

include $(TOPDIR)/Rules.pre

MOCS := $(filter-out $(NOT_MOCS), $(wildcard *.hh) $(MOCS))
BUILD_MOCS := $(addsuffix .moc.o, $(basename $(MOCS)))
BUILD_OBJS := $(BUILD_OBJS) $(BUILD_MOCS)

### dynamic from system ###

X11PREFIX := /usr/X11
X11INCS := $(X11PREFIX)/include
X11LIBS := $(X11PREFIX)/lib

QTPREFIX := $(QTDIR)
QTINCS := $(QTPREFIX)/include
QTLIBS := $(QTPREFIX)/lib

KDEPREFIX := $(shell kde-config --prefix)
KDEINCS := $(KDEPREFIX)/include
KDELIBS := $(KDEPREFIX)/lib

DATADIR := $(KDEPREFIX)/share/apps/netconf
BINDIR := $(KDEPREFIX)/bin
LIBDIR := $(KDEPREFIX)/lib


SYSINCS := $(X11INCS)  $(QTINCS) $(KDEINCS)
SYSLIBS := -L$(X11LIBS) -L$(QTLIBS) -L$(KDELIBS) -lkio -lkdeui -lkdesu 

DEFINES := -DQT_THREAD_SUPPORT  -D_REENTRANT -DQT_CLEAN_NAMESPACE  -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION
# -DQT_NO_ASCII_CAST

####################################

INCDIRS := $(SYSINCS) ../kvtree ../configtree ../systeminfo

INCLUDES := $(filter-out $(NOT_INCS), $(foreach dir, $(INCDIRS), -I$(dir)))
CXXFLAGS := $(DEFINES) -g -O0

BUILD_LIBS :=
LIBS := $(SYSLIBS) ../configtree/configtree.a ../kvtree/kvtree.a ../systeminfo/systeminfo.a

BUILD_PROGS := netconf

LOCS :=  $(filter-out $(NOT_LOCS), $(wildcard locale/*/*.po) $(LOCS))
LOCALIZED := $(addsuffix .gmo, $(basename $(LOCS)))

all: $(BUILD_PROGS) $(LOCALIZED)

include $(TOPDIR)/Rules

%.moc.cc: %.hh
	moc $< > $@

%.gmo: %.po
	rm -f $@ ; /usr/bin/msgfmt -o $@ $<

netconf: main.o $(BUILD_OBJS)
	@echo '  LINK EXEC $@'
	$(Q)$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
#	g++ -g -o $@ $^ -O0 -$(SYSLIBS) ../configtree/configtree.so

.PHONY: messages
messages:
	xgettext -C -ki18n -ktr2i18n  -kI18N_NOOP -ktranslate -kaliasLocale  -x $(KDEPREFIX)/include/kde.pot -C -ki18n *.cc *.hh
	(echo ; date; echo) >> locale/new.log 
	diff messages.po locale/messages.pot >> locale/new.log || true
	mv messages.po locale/messages.pot

.PHONY: install
install:
	mkdir -p $(DATADIR)/pixmaps
	cp -v ./pixmaps/*.png $(DATADIR)/pixmaps
	install -m 755 netconf $(BINDIR)
	install -m 700 netconf-helper.sh /sbin
	for l in locale/*/*.gmo ; do \
		lang=`dirname $$l` ; \
		lang="$${lang#*/}" ; \
		mkdir -p /opt/kde3/share/locale/$$lang/LC_MESSAGES ; \
		cp -v $$l $(KDEPREFIX)/share/locale/$$lang/LC_MESSAGES/netconf.mo ; \
	done

# no dynamic library anymore right now ...
#	ldconfig $(LIBDIR)

include $(TOPDIR)/Rules.post


