1include ../Makefile.conf
2
3
4TARGETOBJS=SYudit.o SToolBar.o SMessageBar.o SMessageLabel.o  \
5SKMapPanel.o SKMapDialog.o SHighlightD.o
6
7TARGETDIR=
8MAINOBJ=Main.o
9MAIN=yudit
10
11LOCALES=$(wildcard locale/*)
12
13ifeq ($(SPLATFORM),WINDOWS)
14TARGET=gui.lib
15OBJS=$(subst .o,.obj,$(TARGETOBJS))
16MAINOBJS=$(subst .o,.obj,$(MAINOBJ))
17SLIBS=/libpath:../stoolkit stoolkit.lib /libpath:../addon addon.lib
18SWINLIBS=/libpath:../swindow  swindow.lib
19SWIDGETLIBS=/libpath:../swidget swidget.lib
20SGUILIBS=/libpath:../gui /subsystem:WINDOWS gui.lib
21MYLIBS=/link /subsystem:WINDOWS $(SGUILIBS) $(SWIDGETLIBS) $(SWINLIBS) $(SLIBS) $(SWINDOW_LIBS) $(ALL_LIBS)
22RESOURCE=yudit.res
23else
24TARGET=libgui.a
25OBJS=$(TARGETOBJS)
26MAINOBJS=$(MAINOBJ)
27
28SLIBS=-L../stoolkit  -lstoolkit  -L../addon -laddon
29SWIDGETLIBS=-L../swidget -lswidget
30SGUILIBS=-L../gui -lgui
31
32ifeq ($(SWINDOWS),OSX)
33SWINLIBS=-L../swindow -lswindow -Wl,-framework,Cocoa
34else
35SWINLIBS=-L../swindow -lswindow
36endif
37
38MYLIBS=$(SGUILIBS) $(SWIDGETLIBS) $(SWINLIBS) $(SLIBS) $(ALL_LIBS)
39RESOURCE=
40endif
41
42.PHONY: messages
43
44all: $(TARGET) $(MAIN)
45
46$(MAIN): $(TARGET) $(MAINOBJS) $(RESOURCE)
47	$(LD) -o yudit $(MAINOBJS) $(RESOURCE) $(MYLIBS)
48
49#
50# This is a windows thing
51#
52yudit.res:
53	rc /Fo $@ yudit.rc
54
55gui.lib: $(OBJS)
56	$(AR)$@ $(subst swin32/,,$(OBJS))
57
58libgui.a: $(OBJS)
59	$(AR) $@ $(OBJS)
60	$(RANLIB) $@
61
62%.o:%.cpp
63	$(CXX) -c $(CPPFLAGS) $(subst .o,.cpp,$@)
64
65%.obj:%.cpp
66	$(CXX) -c $(CPPFLAGS) $(subst .obj,.cpp,$@)
67
68depend:
69	$(CXX) -M  $(CPPFLAGS)  $(patsubst %.o,%.cpp,$(OBJS)) > .depend
70
71install:
72	@for i in $(LOCALES); do \
73		if test ! -d $(DESTDIR)/$(datadir)/yudit/$$i/LC_MESSAGES; then \
74			mkdir -p $(DESTDIR)/$(datadir)/yudit/$$i/LC_MESSAGES; \
75		fi ; \
76		$(INSTALL_DATA) $$i/LC_MESSAGES/messages.[mp]o \
77			$(DESTDIR)/$(datadir)/yudit/$$i/LC_MESSAGES ; \
78		echo installing messages for $$i; \
79	done
80	rm -f $(DESTDIR)/$(bindir)/yudit
81	$(INSTALL_PROGRAM) $(MAIN) $(DESTDIR)/$(bindir)
82
83messages:
84	@if [ $(MSGMERGE) != ":" ] ; then \
85		echo "start translating  messages"; \
86		xgettext --c++ --keyword=translate  ../swidget/*.cpp *.cpp; \
87		for i in $(LOCALES); do \
88			echo $$i/LC_MESSAGES/messages.po ; \
89			cd $$i/LC_MESSAGES ; touch messages.po;  \
90			$(MSGMERGE) --width=100 --strict \
91			  messages.po ../../../messages.po > messages.pod; \
92			if [ $$? != 0 ]; then \
93				cd ../../..; \
94				exit 1; \
95			fi;  \
96			mv messages.pod messages.po; \
97			msgfmt -o messages.mo messages.po;  \
98			cd ../../..; \
99		done ; \
100		echo "end translating  messages" ; \
101	fi
102
103clean:
104	rm -f *.o  *.obj *.o *.exe $(TARGET) $(MAIN)
105
106ifeq (.depend, $(wildcard .depend))
107include .depend
108endif
109