]> Shamusworld >> Repos - ttedit/blob - Makefile
a9a0602cb2f087cb8ac7c6917c3954263f15b30f
[ttedit] / Makefile
1 #
2 # Makefile for TrueType Edit
3 #
4 # Author:     James Hammons
5 # Copyright:  (c) 2006 Underground Software
6 #
7
8 ifeq "$(OSTYPE)" "msys"                                                 # Win32
9
10 SYSTYPE    = __GCCWIN32__
11 EXESUFFIX  = .exe
12 ICON       = obj/icon.o
13 MSG        = Win32 on MinGW
14
15 else
16 #ifeq "$(OSTYPE)" "darwin"
17 ifeq "darwin" "$(findstring darwin,$(OSTYPE))"  # Should catch both 'darwin' and 'darwin7.0'
18
19 SYSTYPE    = __GCCUNIX__ -D_OSX_
20 EXESUFFIX  =
21 ICON       =
22 MSG        = Mac OS X
23
24 else                                                                                    # *nix
25
26 SYSTYPE    = __GCCUNIX__
27 EXESUFFIX  =
28 ICON       =
29 MSG        = generic Unix/Linux
30
31 endif
32 endif
33
34 # This is ugly, ugly, ugly. Find a way to fix this crap so it's more unified,
35 # like the SDL based makefiles are... !!! FIX !!! [made initial stab at it]
36
37 ### Variables: ###
38
39 #EXEEXT = .exe
40 RESCOMP = windres
41 srcdir = ./src
42 top_srcdir = /local
43 top_builddir = /local/
44 CXX = g++
45 TOOLKIT = MSW
46 TOOLKIT_LOWERCASE = msw
47 WX_RELEASE = 2.6
48 WX_VERSION = $(WX_RELEASE).0
49
50 # This is OK
51
52 # Note that the -MMD flag is what gives us our automagic dependency information (*.d files)
53 # Add -g to compile in debugging information
54 CXXFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 `wx-config --cxxflags` -g
55 INCS = -I.
56 LIBS = `wx-config --libs`
57
58 PROGRAM = ttedit
59
60 # KO si sihT
61
62 OBJECTS  =            \
63         obj/bezier.o      \
64         obj/charnames.o   \
65         obj/charwindow.o  \
66         obj/debug.o       \
67         obj/editwindow.o  \
68         obj/glyphpoints.o \
69         obj/registry.o    \
70         obj/toolwindow.o  \
71         obj/ttf.o         \
72         obj/vector.o      \
73         obj/$(PROGRAM).o  \
74         $(ICON)
75
76 BIN_PROGRAM = $(PROGRAM)$(EXESUFFIX)
77 #Need to fix this shit
78 ifneq "" "$(ICON)"
79 RES_PROGRAM_OBJ = obj/$(PROGRAM)_resources.o
80 else
81 RES_PROGRAM_OBJ =
82 endif
83 BUNDLE = $(BIN_PROGRAM).app/Contents
84
85 ### Conditionally set variables: ###
86
87 COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1 = $(RESCOMP) -d __DARWIN__ -t APPL -d \
88         __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) \
89         $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) -i $(srcdir) -d WXUSINGDLL -i \
90         $(srcdir)/../../samples -i $(top_srcdir)/include -o bombs$(EXEEXT) Carbon.r \
91         sample.r
92
93 ### Targets: ###
94
95 all: checkenv message obj $(BIN_PROGRAM) $(__bombs_bundle___depname)
96         @echo
97         @echo "*** Looks like it compiled OK... Give it a whirl!"
98
99 obj:
100         @mkdir obj
101
102 #install: all
103
104 # Check the compilation environment, barf if not appropriate
105
106 checkenv:
107         @echo
108         @echo -n "*** Checking compilation environment... "
109 ifeq "" "$(shell which wx-config)"
110         @echo
111         @echo
112         @echo "It seems that you don't have the wxWidget development libraries installed."
113         @echo "If you have installed them, make sure that the wx-config file is somewhere"
114         @echo "in your path and is executable."
115         @echo
116 #Is there a better way to break out of the makefile?
117 #       @break
118         @breakola!
119 else
120         @echo "OK"
121 endif
122
123 message:
124 #       @echo
125         @echo "*** Building TTEdit for $(MSG)..."
126         @echo
127
128 clean:
129         @echo -n "*** Cleaning out the garbage..."
130         @rm -rf ./obj
131         @rm -f $(BIN_PROGRAM)
132 #       rm -rf bombs.app
133         @echo "done!"
134
135 ## This is only done for Win32 at the moment...
136 #
137 #ifneq "" "$(ICON)"
138 #$(ICON): res/$(TARGET).rc res/$(TARGET).ico
139 #       @echo "*** Processing icon..."
140 #       @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
141 #endif
142
143 # This is only done for Win32 at the moment...
144
145 ifneq "" "$(ICON)"
146 $(RES_PROGRAM_OBJ): res/$(PROGRAM).rc res/$(PROGRAM).ico
147         @echo "*** Processing icon..."
148         @$(RESCOMP) -i$< -o$@ --define __WX$(TOOLKIT)__ --include-dir ./res --define WXUSINGDLL --include-dir $(top_srcdir)/include/wx-2.6
149 endif
150
151 obj/%.o: $(srcdir)/%.cpp
152         @echo "*** Compiling $<..."
153         @$(CXX) -c -o $@ $(INCS) $(CXXFLAGS) $<
154
155 $(BIN_PROGRAM): $(OBJECTS) $(RES_PROGRAM_OBJ)
156         @echo "*** Linking it all together..."
157         @$(CXX) -o $@ $(OBJECTS) $(RES_PROGRAM_OBJ) $(LIBS)
158 #       $(_mac_rezcmd)
159 #       $(_mac_setfilecmd)
160
161 # Mac OSX bundling shit (figure out how to condense this so it works!)
162
163 bombs.app/Contents/PkgInfo: bombs$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns
164         mkdir -p bombs.app/Contents
165         mkdir -p bombs.app/Contents/MacOS
166         mkdir -p bombs.app/Contents/Resources
167
168         sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
169         -e "s/EXECUTABLE/bombs/" \
170         -e "s/VERSION/$(WX_VERSION)/" \
171         $(top_srcdir)/src/mac/carbon/Info.plist.in >bombs.app/Contents/Info.plist
172
173         echo -n "APPL????" >bombs.app/Contents/PkgInfo
174
175         ln -f bombs$(EXEEXT) bombs.app/Contents/MacOS/bombs
176
177         cp -f $(top_srcdir)/src/mac/carbon/wxmac.icns bombs.app/Contents/Resources/wxmac.icns
178
179 #bundle: $(_BUNDLE_TGT_REF_DEP)
180
181 ### Include dependency info, if present:
182
183 -include ./obj/*.d
184
185 ### No idea what this does
186
187 #.PHONY: all install uninstall clean distclean bundle