############################################################################## # This software is distributed under the terms of the General Public License.
#
# Program :        kastrolog 5.4-1
# Authors : see the AUTHORS file
# E-Mail  : Llyra@altavista.com
############################################################################# 


ifeq ($(CC),)
	CC=gcc
endif
ifeq ($(CXX),)
	CXX=g++
endif
ifeq ($(QTDIR),)
	QTDIR=/usr/local/lib/qt
endif
INCLUDE = -I$(QTDIR)/include
ifeq ($(KDEDIR),)
	KDEDIR=/opt/kde
endif
INCLUDE += -I$(KDEDIR)/include
ifeq ($(LDFLAGS),)
	LDFLAGS=-L$(KDEDIR)/lib
endif
ifeq ($(CFLAGS),)
	CFLAGS=-O2 -pipe
endif
ifeq ($(CXXFLAGS),)
	CXXFLAGS=$(CFLAGS)
endif
LIBS = -lqt -lkdecore -lkdeui -lkfile -lkfm -lkimgio -ljpeg -lpng -ltiff -lz
DEP = .depends
PROG = kastrolog

# you shouldn't modify beyond this

HEAD1 = AstroCommand.h AstroInfo.h ColorVector.h SetAstroColor.h SetColors.h \
 AspectSet.h AstroSetAspects.h ObjectSet.h AstroObjectSet.h Restrictions.h \
 StarRestrict.h CalcSettings.h ObscureSettings.h AstroTransits.h \
 AstroProgress.h ChartDetails.h GraphSettings.h
HEAD2 = $(patsubst %.h,%Data.h, $(HEAD1))
HEADERS = AstroMenu.h AstroWidget.h $(HEAD1) $(HEAD2)
SRC1 = $(patsubst %.h,%.cpp, $(HEAD1))
SRC2 = main.cpp AstroMenu.cpp AstroWidget.cpp AstroColor.cpp myLineEdit.cpp
SRC3 = $(SRC1) $(patsubst %.cpp,%Data.cpp, $(SRC1)) $(patsubst %.h,m%.cpp, $(HEADERS)) $(SRC2)
SRC4 = astrolog.c calc.c charts0.c charts1.c charts2.c charts3.c data.c \
 data2.c general.c intrpret.c io.c matrix.c placalc.c placalc2.c xcharts0.c \
 xcharts1.c xcharts2.c xdata.c xdevice.c xgeneral.c xscreen.c
CPPOBJS = $(subst .cpp,.o,$(SRC3))
OBJS = $(CPPOBJS) $(subst .c,.o,$(SRC4))

all: $(PROG)

m%.cpp : %.h
	moc -o $@ $<

%.o   : %.cpp
	$(CXX) $(INCLUDE) $(CXXFLAGS) -o $@ -c $<

# These targets has been added because a bug occured when charts1-2 .c compiled
# with -Ox where x > 1.

#charts1.o: charts1.c
#	$(CC) $(INCLUDE) -O -pipe -o $@ -c $<

#charts2.o: charts2.c
#	$(CC) $(INCLUDE) -O -pipe -o $@ -c $<
 
# Normal C targets
%.o   : %.c
	$(CC) $(INCLUDE) $(CFLAGS) -o $@ -c $<

$(SRC1):

$(HEADERS):

$(PROG): $(OBJS)
	$(CXX) -o $@ $(LDFLAGS) $^ $(LIBS)

clean:
	rm *.o $(PROG) $(patsubst %.h,m%.cpp, $(HEADERS))

$(DEP):
	echo > $@

depend: $(DEP)
	$(CXX) $(INCLUDE) -MM -E $(SRC1) $(SRC2) > $(DEP)
	$(CC)  $(INCLUDE) -MM -E $(SRC4) >> $(DEP)

cppgettext: $(SRC3)
	xgettext -C -ktr -o ../po/cppmess.po $^

cgettext: $(SRC4)
	xgettext -ktr -o ../po/cmess.po $^

gettext: cgettext cppgettext

include $(DEP)










