]> Shamusworld >> Repos - ttedit/blob - Makefile
Move main repo to trunk.
[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 debuggin 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/debug.o       \
66         obj/glyphpoints.o \
67         obj/registry.o    \
68         obj/ttf.o         \
69         obj/vector.o      \
70         obj/$(PROGRAM).o  \
71         $(ICON)
72
73 BIN_PROGRAM = $(PROGRAM)$(EXESUFFIX)
74 #Need to fix this shit
75 ifneq "" "$(ICON)"
76 RES_PROGRAM_OBJ = obj/$(PROGRAM)_resources.o
77 else
78 RES_PROGRAM_OBJ =
79 endif
80 BUNDLE = $(BIN_PROGRAM).app/Contents
81
82 ### Conditionally set variables: ###
83
84 COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_1 = $(RESCOMP) -d __DARWIN__ -t APPL -d \
85         __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) \
86         $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) -i $(srcdir) -d WXUSINGDLL -i \
87         $(srcdir)/../../samples -i $(top_srcdir)/include -o bombs$(EXEEXT) Carbon.r \
88         sample.r
89
90 ### Targets: ###
91
92 all: checkenv message obj $(BIN_PROGRAM) $(__bombs_bundle___depname)
93         @echo
94         @echo "*** Looks like it compiled OK... Give it a whirl!"
95
96 obj:
97         @mkdir obj
98
99 #install: all
100
101 # Check the compilation environment, barf if not appropriate
102
103 checkenv:
104         @echo
105         @echo -n "*** Checking compilation environment... "
106 ifeq "" "$(shell which wx-config)"
107         @echo
108         @echo
109         @echo "It seems that you don't have the wxWidget development libraries installed."
110         @echo "If you have installed them, make sure that the wx-config file is somewhere"
111         @echo "in your path and is executable."
112         @echo
113 #Is there a better way to break out of the makefile?
114 #       @break
115         @breakola!
116 else
117         @echo "OK"
118 endif
119
120 message:
121 #       @echo
122         @echo "*** Building TTEdit for $(MSG)..."
123         @echo
124
125 clean:
126         @echo -n "*** Cleaning out the garbage..."
127         @rm -rf ./obj
128         @rm -f $(BIN_PROGRAM)
129 #       rm -rf bombs.app
130         @echo "done!"
131
132 ## This is only done for Win32 at the moment...
133 #
134 #ifneq "" "$(ICON)"
135 #$(ICON): res/$(TARGET).rc res/$(TARGET).ico
136 #       @echo "*** Processing icon..."
137 #       @windres -i res/$(TARGET).rc -o $(ICON) --include-dir=./res
138 #endif
139
140 # This is only done for Win32 at the moment...
141
142 ifneq "" "$(ICON)"
143 $(RES_PROGRAM_OBJ): res/$(PROGRAM).rc res/$(PROGRAM).ico
144         @echo "*** Processing icon..."
145         @$(RESCOMP) -i$< -o$@ --define __WX$(TOOLKIT)__ --include-dir ./res --define WXUSINGDLL --include-dir $(top_srcdir)/include/wx-2.6
146 endif
147
148 obj/%.o: $(srcdir)/%.cpp
149         @echo "*** Compiling $<..."
150         @$(CXX) -c -o $@ $(INCS) $(CXXFLAGS) $<
151
152 $(BIN_PROGRAM): $(OBJECTS) $(RES_PROGRAM_OBJ)
153         @echo "*** Linking it all together..."
154         @$(CXX) -o $@ $(OBJECTS) $(RES_PROGRAM_OBJ) $(LIBS)
155 #       $(_mac_rezcmd)
156 #       $(_mac_setfilecmd)
157
158 # Mac OSX bundling shit (figure out how to condense this so it works!)
159
160 bombs.app/Contents/PkgInfo: bombs$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns
161         mkdir -p bombs.app/Contents
162         mkdir -p bombs.app/Contents/MacOS
163         mkdir -p bombs.app/Contents/Resources
164
165         sed -e "s/IDENTIFIER/`echo $(srcdir) | sed -e 's,\.\./,,g' | sed -e 's,/,.,g'`/" \
166         -e "s/EXECUTABLE/bombs/" \
167         -e "s/VERSION/$(WX_VERSION)/" \
168         $(top_srcdir)/src/mac/carbon/Info.plist.in >bombs.app/Contents/Info.plist
169
170         echo -n "APPL????" >bombs.app/Contents/PkgInfo
171
172         ln -f bombs$(EXEEXT) bombs.app/Contents/MacOS/bombs
173
174         cp -f $(top_srcdir)/src/mac/carbon/wxmac.icns bombs.app/Contents/Resources/wxmac.icns
175
176 #bundle: $(_BUNDLE_TGT_REF_DEP)
177
178 ### Include dependency info, if present:
179
180 -include ./obj/*.d
181
182 ### No idea what this does
183
184 #.PHONY: all install uninstall clean distclean bundle