1 # J-Ben Makefile for Linux and Windows
3 ### User-editable options ###
4 # PLATFORM: either windows or gtk20
6 # BUILD: either release, debug, or profile
8 # MAKE: change the make command, if needed
11 ifeq ($(PLATFORM
),windows
)
12 # CHANGE THESE 4 VARIABLES
14 mingwbase
= C
:/dev
/MinGW
15 boostbase
= C
:/dev
/boost_1_34_1
16 wxbase
= C
:/dev
/wxMSW-2.8
.7
17 wxbuildflags
= -DWXUSINGDLL
-DwxUSE_UNICODE
18 stlportbase
= C
:/dev
/STLport-5.1
.5
19 iconvbase
= C
:/dev
/libiconv
20 mkdircmd
= C
:/progra~
1/gnuwin32
/bin
/mkdir
-p
21 # NOTE: wxWidgets is assumed to be built with wxUSINGDLL and wxUSE_UNICODE.
22 # Also, I'm currently using a release build of wxWidgets regardless of
23 # whether a debug or release build is chosen. I may change this later.
25 # The following variables probably should NOT be changed.
26 wxplatformflags
= -D__GNUWIN32__
-D__WXMSW__
27 # STLPort specifies -pthreads - does -mthreads work fine for this???
28 wincxxflags
= -pipe
-mthreads
29 winlinkflags
= -mwindows
31 wxinclude
= $(wxbase
)/include
32 wxcontribinc
= $(wxbase
)/contrib
/include
33 wxlibinc
= $(wxbase
)/lib
/gcc_dll
/mswu
35 wxliblink
= $(wxbase
)/lib
/gcc_dll
36 SharedCXXFLAGS
= $(wincxxflags
)
37 SharedCPPFLAGS
= -I
$(stlportbase
)/stlport
$(wxbuildflags
) \
38 $(wxplatformflags
) -I
$(wxinclude
) -I
$(wxcontribinc
) -I
$(wxlibinc
) \
39 -I
$(boostbase
) -I
$(mingwbase
)/include -I
$(iconvbase
)/include
40 libs
= -L
$(stlportbase
)/lib
-L
$(wxliblink
) -L
$(mingwbase
)/lib
-L
$(iconvbase
)/lib \
41 -lwxmsw28u_html
-lwxmsw28u_core
-lwxbase28u
$(winlinkflags
) -liconv
-lstlport
.5.1.dll
44 ##################################
45 # DO NOT EDIT BEYOND THIS POINT! #
46 ##################################
50 OBJDIR
= obj
/$(PLATFORM
)/$(BUILD
)
51 BINDIR
= bin
/$(PLATFORM
)/$(BUILD
)
52 DEPDIR
= dep
/$(PLATFORM
)/$(BUILD
)
54 # Get flags/libs for GTK builds
55 ifeq ($(PLATFORM
),gtk20
)
57 SharedCXXFLAGS
= `wx-config --cxxflags` `pkg-config --cflags gtk+-2.0`
58 SharedCPPFLAGS
= `wx-config --cppflags`
59 libs
= `wx-config --libs` `pkg-config --libs gtk+-2.0`
65 ifeq ($(BUILD
),release
)
66 CXXFLAGS
= -Wall
-s
-O2
$(SharedCXXFLAGS
)
67 CPPFLAGS
= $(SharedCPPFLAGS
)
70 CXXFLAGS
= -Wall
-g
$(SharedCXXFLAGS
)
71 CPPFLAGS
= -DDEBUG
$(SharedCPPFLAGS
)
73 ifeq ($(BUILD
),profile
)
74 # Profiling mode: DEBUG flags, plus -pg, but without -DDEBUG
75 CXXFLAGS
= -Wall
-g
$(SharedCXXFLAGS
) -pg
76 CPPFLAGS
= $(SharedCPPFLAGS
)
79 sources
= $(shell ls
-t
*.
cpp) # Compile most recently edited files first.
81 # Build object configuration
82 ifeq ($(PLATFORM
),windows
)
83 objects
= $(sources
:%.
cpp=$(OBJDIR
)/%.o
) $(OBJDIR
)/jben.res
84 target
= $(BINDIR
)/jben.exe
86 objects
= $(sources
:%.
cpp=$(OBJDIR
)/%.o
)
87 target
= $(BINDIR
)/jben
90 # Select build environment type
95 ifeq ($(PLATFORM
),windows
)
105 all: $(target
) kpengine
107 .PHONY
: kpengine
clean cleandep cleanall
109 $(target
) : $(objects
)
110 $(mkdircmd
) $(BINDIR
)
111 $(CXX
) $(CXXFLAGS
) -o
$(target
) $(objects
) $(libs
)
115 $(mkdircmd
) $(OBJDIR
)
116 windres.exe
-i jben.rc
-J rc
-o
$(OBJDIR
)/jben.res
-O coff
-I
$(wxinclude
) -I
$(wxlibinc
) -I
$(mingwbase
)/include
119 cd kanjipad
&& $(MAKE
) && cd ..
122 cd kanjipad
&& make
clean && cd ..
123 rm -rfv bin obj jben.res
128 cleanall
: clean cleandep
130 $(OBJDIR
)/%.o
: %.
cpp
131 $(mkdircmd
) $(OBJDIR
)
132 $(CXX
) $(CXXFLAGS
) $(CPPFLAGS
) -c
-o
$@
$(@F
:%.o
=%.
cpp)
134 # Object dependency tracking
135 include $(sources
:%.
cpp=$(DEPDIR
)/%.d
)
136 $(DEPDIR
)/%.d
: %.
cpp
137 @echo Recreating
$@...
138 @
$(mkdircmd
) $(DEPDIR
)
139 @
$(CXX
) -MM
$(CPPFLAGS
) $< > $@.mktmp
140 ifeq ($(buildenv
),windows
)
141 @sed
"s,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : ,g" < $@.mktmp
> $@
143 # @sed 's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : $(OBJDIR) ,g' < $@.mktmp > $@
144 @sed
's,\($*\)\.o[ :]*,$(OBJDIR)/\1.o $@ : ,g' < $@.mktmp
> $@