1818global_requirements = $(LIBJDKMIDI_LIB ) $(CPPSOURCES ) $(CSOURCES ) $(MSOURCES ) \
1919$(BIN ) /$(EXECUTABLE_DEBUGGER ) $(BIN ) /$(EXECUTABLE_TRACKER )
2020
21+ # Pretty (long, space delim) names for the apps
22+ PRETTY_DEBUGGER = SPC Debugger
23+ PRETTY_TRACKER = SNES Tracker
24+
2125# This is where source that both tracker and STD will use. NOTE THE inclusion of the forward slash ;)
2226SHARED_DIR = shared/
2327PROJ_DIR = ext
@@ -143,7 +147,8 @@ else ifeq ($(uname_S), Cross_Windows)
143147 CPPFLAGS += -fpermissive
144148 # NFD
145149 CPPSOURCES += $(PROJ_DIR)/NativeFileDialog/nfd_win.cpp
146- LDFLAGS += -lole32 # -static-libgcc #-lcomctl32 -lcomdlg32
150+ # uuid needed for nfd
151+ LDFLAGS += -lole32 -luuid # -static-libgcc #-lcomctl32 -lcomdlg32
147152 BOOST_LDFLAGS := -lboost_system -lboost_filesystem
148153 # Example of static library inclusion:
149154 # BOOST_LDFLAGS := $(prefix)/lib/libboost_system.a $(prefix)/lib/libboost_filesystem.a
@@ -171,6 +176,8 @@ else ifeq ($(uname_S), Cross_Windows)
171176 EXECUTABLE_TRACKER = st.exe
172177 UNRAR = unrar.exe
173178 DEC7Z = 7zDec.exe
179+
180+ OBJECTS_TRACKER := winres.o
174181else ifeq ($(uname_S), Windows)
175182
176183else
@@ -212,7 +219,7 @@ $(wildcard tracker/*/*/*.cpp)
212219
213220#
214221OBJECTS_DEBUGGER = $(CPPSOURCES_DEBUGGER:.cpp=.o ) $(MSOURCES:.m=.o ) $(CSOURCES:.c=.o )
215- OBJECTS_TRACKER = $(CPPSOURCES_TRACKER:.cpp=.o ) $(MSOURCES:.m=.o ) $(CSOURCES:.c=.o )
222+ OBJECTS_TRACKER + = $(CPPSOURCES_TRACKER:.cpp=.o ) $(MSOURCES:.m=.o ) $(CSOURCES:.c=.o )
216223
217224OBJECTS_DEBUGGER2 = $(addprefix $(OBJ ) /, $(OBJECTS_DEBUGGER ) )
218225OBJECTS_TRACKER2 = $(addprefix $(OBJ ) /, $(OBJECTS_TRACKER ) )
@@ -234,25 +241,80 @@ $(BIN)/$(EXECUTABLE_DEBUGGER).app: Info.plist osx_ship.sh $(BIN)/$(EXECUTABLE_DE
234241 cp -r $(BIN ) /cursors $@ /Contents/Resources # Copy mouse icons
235242 bash ./osx_ship.sh $@ $(EXECUTABLE_DEBUGGER ) $@ /Contents/Lib
236243 touch $@
244+ # Have a pretty version
245+ cp -r $@ " $( BIN) /$( PRETTY_DEBUGGER) .app"
246+ mv $@ /Contents/MacOS/$(EXECUTABLE_DEBUGGER ) " $( BIN) /$( PRETTY_DEBUGGER) .app/Contents/MacOS/$( PRETTY_DEBUGGER) "
237247
238- $(BIN ) /$(EXECUTABLE_TRACKER ) .app : Info.plist osx_ship.sh $(BIN ) /$(EXECUTABLE_TRACKER ) $(BIN ) /$(UNRAR ) $(BIN ) /$(DEC7Z )
248+ $(BIN ) /$(EXECUTABLE_TRACKER ) .app : st.icns Info.plist osx_ship.sh $(BIN ) /$(EXECUTABLE_TRACKER ) $(BIN ) /$(UNRAR ) $(BIN ) /$(DEC7Z )
239249 mkdir -p $@ $@ /Contents/Lib $@ /Contents/Resources $@ /Contents/MacOS
240250 cp $(BIN ) /$(EXECUTABLE_TRACKER ) $@ /Contents/MacOS
241251 cp Info.plist $@ /Contents
242252 cp $(BIN ) /$(UNRAR ) $@ /Contents/Resources
243253 cp $(BIN ) /$(DEC7Z ) $@ /Contents/Resources
254+ cp st.icns $@ /Contents/Resources
244255 cp -r $(BIN ) /cursors $@ /Contents/Resources # Copy mouse icons
245256 cp $(BIN ) /tracker.spc $@ /Contents/Resources # copy SPC driver
246257 bash ./osx_ship.sh $@ $(EXECUTABLE_TRACKER ) $@ /Contents/Lib
247258 # $@/Contents/MacOS/$(EXECUTABLE_TRACKER)
248259 touch $@
249-
260+ # Have a pretty version
261+ cp -r $@ " $( BIN) /$( PRETTY_TRACKER) .app"
262+ mv $@ /Contents/MacOS/$(EXECUTABLE_TRACKER ) " $( BIN) /$( PRETTY_TRACKER) .app/Contents/MacOS/$( PRETTY_TRACKER) "
263+
264+ # Automated creation of Mac icon pack (icns) from our PNG renders
265+ st.icns :
266+ mkdir -p $(OBJ ) /st.iconset
267+ cp st-icons-png/1024-stroked-thick.png $(OBJ ) /st.iconset/icon_512x512@2x.png
268+ cp st-icons-png/512-stroked-thick.png $(OBJ ) /st.iconset/icon_512x512.png
269+ cp st-icons-png/512-stroked-thick.png $(OBJ ) /st.iconset/icon_256x256@2x.png
270+ cp st-icons-png/256-stroked-thick.png $(OBJ ) /st.iconset/icon_256x256.png
271+ cp st-icons-png/256-stroked-thick.png $(OBJ ) /st.iconset/icon_128x128@2x.png
272+ cp st-icons-png/128-stroked.png $(OBJ ) /st.iconset/icon_128x128.png
273+ cp st-icons-png/64.png $(OBJ ) /st.iconset/icon_32x32@2x.png
274+ cp st-icons-png/32.png $(OBJ ) /st.iconset/icon_32x32.png
275+ cp st-icons-png/32.png $(OBJ ) /st.iconset/icon_16x16@2x.png
276+ cp st-icons-png/16.png $(OBJ ) /st.iconset/icon_16x16.png
277+ iconutil -c icns -o st.icns $(OBJ ) /st.iconset
278+
279+ # Automatic creation of Windows icon pack (ico) from our PNG renders
280+ # Depends on ImageMagick
281+ st.ico : st-icons-png/256-stroked-thick.png st-icons-png/64.png st-icons-png/48.png\
282+ st-icons-png/32.png st-icons-png/24.png st-icons-png/16.png Makefile
283+ rm -rf $(OBJ ) /st-ico/
284+ mkdir -p $(OBJ ) /st-ico
285+ convert st-icons-png/256-stroked-thick.png $(OBJ ) /st-ico/256-32bit.png
286+ # convert st-icons-png/256-stroked-thick.png -depth 8 -colors 256 $(OBJ)/st-ico/256-8bit.ico
287+ # convert st-icons-png/256-stroked-thick.png -depth 4 -colors 16 $(OBJ)/st-ico/256-4bit.ico
288+ convert st-icons-png/128-stroked.png $(OBJ ) /st-ico/128-32bit.png
289+ # convert st-icons-png/128-stroked.png -depth 8 -colors 256 $(OBJ)/st-ico/128-8bit.ico
290+ # convert st-icons-png/128-stroked.png -depth 4 -colors 16 $(OBJ)/st-ico/128-4bit.ico
291+ convert st-icons-png/64.png $(OBJ ) /st-ico/64-32bit.png
292+ # convert st-icons-png/64.png -depth 8 -colors 256 +dither $(OBJ)/st-ico/64-8bit.png
293+ # convert st-icons-png/64.png -depth 4 -colors 16 +dither $(OBJ)/st-ico/64-4bit.png
294+ convert st-icons-png/48.png $(OBJ ) /st-ico/48-32bit.png
295+ convert st-icons-png/48.png -depth 8 -colors 256 +dither $(OBJ ) /st-ico/48-8bit.png
296+ convert st-icons-png/48.png -depth 4 -colors 16 +dither $(OBJ ) /st-ico/48-4bit.png
297+ convert st-icons-png/32.png $(OBJ ) /st-ico/32-32bit.png
298+ convert st-icons-png/32.png -depth 8 -colors 256 +dither $(OBJ ) /st-ico/32-8bit.png
299+ convert st-icons-png/32.png -depth 4 -colors 16 +dither $(OBJ ) /st-ico/32-4bit.png
300+ #
301+ convert st-icons-png/24.png $(OBJ ) /st-ico/24-32bit.png
302+ convert st-icons-png/24.png -depth 8 -colors 256 +dither $(OBJ ) /st-ico/24-8bit.png
303+ convert st-icons-png/24.png -depth 4 -colors 16 +dither $(OBJ ) /st-ico/24-4bit.png
304+ convert st-icons-png/16.png $(OBJ ) /st-ico/16-32bit.png
305+ convert st-icons-png/16.png -depth 8 -colors 256 +dither $(OBJ ) /st-ico/16-8bit.png
306+ convert st-icons-png/16.png -depth 4 -colors 16 +dither $(OBJ ) /st-ico/16-4bit.png
307+ convert $(OBJ ) /st-ico/* .png st.ico
250308
251309$(BIN ) /$(EXECUTABLE_DEBUGGER ) : $(OBJECTS_DEBUGGER2 ) $(BIN ) /$(UNRAR ) $(BIN ) /$(DEC7Z ) $(LIBJDKMIDI_LIB )
252310 $(CC ) $(OBJECTS_DEBUGGER2 ) $(LDFLAGS ) -o $@
311+ # For the Windows version. and don't error out on non-windows by returning true from a subshell
312+ ( cp $( BIN) /{std.exe," $( PRETTY_DEBUGGER) .exe" } ; true )
253313
254314$(BIN ) /$(EXECUTABLE_TRACKER ) : $(OBJECTS_TRACKER2 ) $(BIN ) /$(UNRAR ) $(BIN ) /$(DEC7Z ) $(LIBJDKMIDI_LIB )
255315 $(CC ) $(OBJECTS_TRACKER2 ) $(LDFLAGS ) -o $@
316+ # For the Windows version. and don't error out on non-windows by returning true from a subshell
317+ ( cp $( BIN) /{st.exe," $( PRETTY_TRACKER) .exe" } ; true )
256318
257319
258320$(BIN ) /$(DEC7Z ) : $(PROJ_DIR ) /lzma1505/C/Util/7z/$(DEC7Z ) $(PROJ_DIR ) /lzma1505/C/Util/7z/7zMain.c
@@ -286,13 +348,17 @@ $(OBJ)/%.o: %.cpp
286348$(OBJ ) /% .o : % .m
287349 @mkdir -p $(@D )
288350 $(OBJCC ) $(OBJCFLAGS ) -c $< -o $@
351+
352+ $(OBJ ) /winres.o : winres.rc st.ico
353+ $(CROSS_COMPILE ) windres winres.rc $(OBJ ) /winres.o
289354
290355clean :
291356 @# Remove both Linux and Windows versions of unrar and 7zdec
292357 rm -f $(BIN ) /{unrar,unrar.exe}
293358 rm -f $(BIN ) /{7zDec,7zDec.exe}
294359 rm -f $(BIN ) /$(EXECUTABLE_DEBUGGER ) ;
295360 rm -f $(BIN ) /$(EXECUTABLE_TRACKER ) ;
361+ rm -rf $(OBJ )
296362 find . -name " *.o" -o -name " *.d" | xargs rm -rf
297363 rm -f {$(PROJ_DIR ) /lzma1505/C/Util/7z/,}{7zDec,7zDec.exe}
298364 rm -f {$(PROJ_DIR ) /unrar/,}{unrar,unrar.exe}
0 commit comments