NAME = ivv
PROGRAM = $(NAME).exe#
ICON = $(NAME).ico
OBJS = main.o IncompleteVRMLViewer.o InfoDialog.o

FLEX = @FLEX@
BISON = @BISON@
PKG_CONFIG = @PKG_CONFIG@

CFLAGS = -Wall -O2 -mms-bitfields -IReader -IReader/VRMLReader -ISceneGraph -IToolkit -IUtility $(FLAGS) `$(PKG_CONFIG) --define-variable=prefix=$(PREFIX_MINGW32) --cflags gtk+-2.0 gtkglext-1.0`
LDFLAGS = -mwindows -L. -LReader -lReader -LToolkit -lToolkit -LSceneGraph -lSceneGraph -LUtility -lUtility `$(PKG_CONFIG) --define-variable=prefix=$(PREFIX_MINGW32) --libs gtk+-2.0 gtkglext-1.0`

CC = i586-mingw32msvc-g++
LD = i586-mingw32msvc-g++
RM = /bin/rm -f
WINDRES = i586-mingw32msvc-windres

all: $(OBJS) Reader SceneGraph Toolkit Utility
	$(WINDRES) -o $(ICON).o $(NAME).rc
	$(LD) $(OBJS) $(ICON).o -o $(PROGRAM) $(LDFLAGS)

%.o: %.cpp
	$(CC) $(CFLAGS) -c $< -o $@

Reader:
	cd Reader && make -f Makefile.MinGW32 BISON=$(BISON) FLEX=$(FLEX)

SceneGraph:
	cd SceneGraph && make -f Makefile.MinGW32

Toolkit:
	cd Toolkit && make -f Makefile.MinGW32 PKG_CONFIG=$(PKG_CONFIG)

Utility:
	cd Utility && make -f Makefile.MinGW32

clean:
	cd Reader && make clean -f Makefile.MinGW32
	cd SceneGraph && make clean -f Makefile.MinGW32
	cd Toolkit && make clean -f Makefile.MinGW32
	cd Utility && make clean -f Makefile.MinGW32
	$(RM) *~ *.o $(PROGRAM)

.PHONY: Reader SceneGraph Toolkit Utility

