-#
-# File: makefile.unx
-# Author: Julian Smart
-# Created: 1993
-# Updated:
-# Copyright: (c) 1993, AIAI, University of Edinburgh
-#
-# "%W% %G%"
-#
-# Makefile for docview example (UNIX).
+# =========================================================================
+# This makefile was generated by
+# Bakefile 0.2.5 (http://www.bakefile.org)
+# Do not modify, all changes will be overwritten!
+# =========================================================================
-WXDIR = ../..
-# All common UNIX compiler flags and options are now in
-# this central makefile.
-include $(WXDIR)/src/make.env
-OBJECTS = $(OBJDIR)/docview.$(OBJSUFF) $(OBJDIR)/view.$(OBJSUFF) $(OBJDIR)/doc.$(OBJSUFF)
+# -------------------------------------------------------------------------
+# These are configurable options:
+# -------------------------------------------------------------------------
-.SUFFIXES:
+# C++ compiler
+CXX = g++
-all: $(OBJDIR) wx$(GUISUFFIX) docview$(GUISUFFIX)
+# Standard flags for C++
+CXXFLAGS ?=
-wx_motif:
- cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx motif
+# Standard preprocessor flags (common for CC and CXX)
+CPPFLAGS ?=
-wx_ol:
- cd $(WXDIR)/src/x; $(MAKE) -f makefile.unx xview
-motif:
- $(MAKE) -f makefile.unx GUISUFFIX=_motif GUI=-Dwx_motif GUISUFFIX=_motif OPT='$(OPT)' LDLIBS='$(MOTIFLDLIBS)' OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)' XVIEW_LINK=
+# Standard linker flags
+LDFLAGS ?=
-xview:
- $(MAKE) -f makefile.unx GUI=-Dwx_xview GUISUFFIX=_ol CC=$(CC) OPTIONS='$(OPTIONS)' DEBUG='$(DEBUG)' WARN='$(WARN)' XLIB='$(XLIB)' XINCLUDE='$(XINCLUDE)'
+# Location and arguments of wx-config script
+WX_CONFIG ?= wx-config
-hp:
- $(MAKE) -f makefile,unx GUI=-Dwx_motif GUISUFFIX=_hp CC=CC DEBUG='$(DEBUG)' WARN='-w' \
- XINCLUDE='$(HPXINCLUDE)' XLIB='$(HPXLIB)' XVIEW_LINK='' LDLIBS='$(HPLDLIBS)'
+# Port of the wx library to build against [gtk1,gtk2,msw,x11,motif,mgl,mac,dfb]
+WX_PORT ?= $(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 1)
-$(OBJDIR):
- mkdir $(OBJDIR)
+# Use DLL build of wx library to use? [0,1]
+WX_SHARED ?= $(shell if test -z `$(WX_CONFIG) --selected-config | cut -d '-' -f 5`; then echo 1; else echo 0; fi)
-docview$(GUISUFFIX): $(OBJECTS) $(WXLIB)
- $(CC) $(LDFLAGS) -o docview$(GUISUFFIX) $(OBJECTS) $(XVIEW_LINK) $(LDLIBS)
+# Compile Unicode build of wxWidgets? [0,1]
+WX_UNICODE ?= $(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 2 | sed 's/unicode/1/;s/ansi/0/')
-$(OBJDIR)/docview.$(OBJSUFF): docview.$(SRCSUFF) docview.h doc.h view.h
- $(CC) -c $(CPPFLAGS) -o $@ docview.$(SRCSUFF)
+# Use debug build of wxWidgets (define __WXDEBUG__)? [0,1]
+WX_DEBUG ?= $(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 3 | sed 's/debug/1/;s/release/0/')
-$(OBJDIR)/doc.$(OBJSUFF): doc.$(SRCSUFF) doc.h
- $(CC) -c $(CPPFLAGS) -o $@ doc.$(SRCSUFF)
+# Version of the wx library to build against.
+WX_VERSION ?= $(shell $(WX_CONFIG) --selected-config | sed -e 's/.*-\([0-9]*\)\.\([0-9]*\)$$/\1\2/')
-$(OBJDIR)/view.$(OBJSUFF): view.$(SRCSUFF) view.h
- $(CC) -c $(CPPFLAGS) -o $@ view.$(SRCSUFF)
-clean_motif:
- $(MAKE) -f makefile.unx GUISUFFIX=_motif cleanany
-clean_ol:
- $(MAKE) -f makefile.unx GUISUFFIX=_ol cleanany
+# -------------------------------------------------------------------------
+# Do not modify the rest of this file!
+# -------------------------------------------------------------------------
-clean_hp:
- $(MAKE) -f makefile.unx GUISUFFIX=_hp cleanany
+### Variables: ###
-cleanany:
- rm -f $(OBJECTS) docview$(GUISUFFIX) core
+CPPDEPS = -MT$@ -MF`echo $@ | sed -e 's,\.o$$,.d,'` -MD -MP
+WX_VERSION_MAJOR = $(shell echo $(WX_VERSION) | cut -c1,1)
+WX_VERSION_MINOR = $(shell echo $(WX_VERSION) | cut -c2,2)
+WX_CONFIG_FLAGS = $(WX_CONFIG_DEBUG_FLAG) $(WX_CONFIG_UNICODE_FLAG) \
+ $(WX_CONFIG_SHARED_FLAG) --toolkit=$(WX_PORT) \
+ --version=$(WX_VERSION_MAJOR).$(WX_VERSION_MINOR)
+DOCVIEW_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \
+ $(CXXFLAGS)
+DOCVIEW_OBJECTS = \
+ docview_docview.o \
+ docview_doc.o \
+ docview_view.o
+
+### Conditionally set variables: ###
+
+ifeq ($(WX_DEBUG),0)
+WX_CONFIG_DEBUG_FLAG = --debug=no
+endif
+ifeq ($(WX_DEBUG),1)
+WX_CONFIG_DEBUG_FLAG = --debug=yes
+endif
+ifeq ($(WX_UNICODE),0)
+WX_CONFIG_UNICODE_FLAG = --unicode=no
+endif
+ifeq ($(WX_UNICODE),1)
+WX_CONFIG_UNICODE_FLAG = --unicode=yes
+endif
+ifeq ($(WX_SHARED),0)
+WX_CONFIG_SHARED_FLAG = --static=yes
+endif
+ifeq ($(WX_SHARED),1)
+WX_CONFIG_SHARED_FLAG = --static=no
+endif
+
+
+### Targets: ###
+
+all: test_for_selected_wxbuild docview
+
+install:
+
+uninstall:
+
+clean:
+ rm -f ./*.o
+ rm -f ./*.d
+ rm -f docview
+
+test_for_selected_wxbuild:
+ @$(WX_CONFIG) $(WX_CONFIG_FLAGS)
+
+docview: $(DOCVIEW_OBJECTS)
+ $(CXX) -o $@ $(DOCVIEW_OBJECTS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs core,base` $(LDFLAGS)
+
+docview_docview.o: ./docview.cpp
+ $(CXX) -c -o $@ $(DOCVIEW_CXXFLAGS) $(CPPDEPS) $<
+
+docview_doc.o: ./doc.cpp
+ $(CXX) -c -o $@ $(DOCVIEW_CXXFLAGS) $(CPPDEPS) $<
+
+docview_view.o: ./view.cpp
+ $(CXX) -c -o $@ $(DOCVIEW_CXXFLAGS) $(CPPDEPS) $<
+
+.PHONY: all install uninstall clean
+
+
+# Dependencies tracking:
+-include ./*.d