Skip to content

Commit

Permalink
Merge pull request #198 from kobenairb/makefile_tmx2sne
Browse files Browse the repository at this point in the history
Optimize tmx2sne makefile
  • Loading branch information
RetroAntho committed Apr 13, 2023
2 parents 7de3b7d + 9dae1c8 commit b067751
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
40 changes: 16 additions & 24 deletions tools/tmx2snes/Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,40 @@
VERSION = "1.0.0"
VERSION := "1.0.0"
DATESTRING := $(shell date +%Y%m%d)

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CC=gcc
CFLAGS=-g -O2 -Wall -Wno-implicit-function-declaration -Wno-unused-result -D__BUILD_DATE="\"`date +'%Y%m%d'`\"" -D__BUILD_VERSION="\"$(VERSION)\""
CC ?= gcc
CFLAGS := -g -O2 -Wall -Wno-implicit-function-declaration -Wno-unused-result -D__BUILD_DATE="\"`date +'%Y%m%d'`\"" -D__BUILD_VERSION="\"$(VERSION)\""

SOURCES=tmx2snes.c
OBJS=tmx2snes.o
SOURCES := $(wildcard *.c)
OBJS := $(SOURCES:%.c=%.o)
EXE=tmx2snes
DEFINES=
LIBS=

ifeq ($(OS),Windows_NT)
EXT=.exe
# CFLAGS += -D__HAS_STRUPR
else
EXT=
endif

# We want to build the project with static libraries except for Mac OS because the manual page of gcc explain:
# "The static option will not work on Mac OS X unless all libraries (including libgcc.a) have also been compiled with -static.
# We want to build the project with static libraries except
# for Mac OS because the manual page of gcc explain:
# "The static option will not work on Mac OS X unless
# all libraries (including libgcc.a) have also been compiled with -static.
# Since neither a static version of libSystem.dylib nor crt0.o are provided, this option is not useful to most people."
ifneq ($(shell uname -s),Darwin)
CFLAGS+=-static
CFLAGS+=-static
endif



#---------------------------------------------------------------------------------
all: $(EXE)$(EXT)

#---------------------------------------------------------------------------------
$(EXE)$(EXT) : $(OBJS)
@echo make exe $(notdir $<)
@echo "Linking $@"
$(CC) $(CFLAGS) $(OBJS) -o $@

tmx2snes.o : tmx2snes.c
@echo make obj $(notdir $<)
%.o : %.c
@echo "Compiling $<"
$(CC) $(CFLAGS) -c $<

#---------------------------------------------------------------------------------
clean:
rm -f *.tds $(EXE)$(EXT) $(OBJS)
@rm -f $(EXE)$(EXT) $(OBJS)

install:
cp $(EXE)$(EXT) ../../devkitsnes/tools/$(EXE)$(EXT)
@cp $(EXE)$(EXT) ../../devkitsnes/tools/$(EXE)$(EXT)
2 changes: 1 addition & 1 deletion tools/tmx2snes/tmx2snes.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void PrintOptions(char *str)
//////////////////////////////////////////////////////////////////////////////
void PrintVersion(void)
{
printf("\ntmx2snes.exe (" TMX2SNESDATE ") version " TMX2SNESVERSION "");
printf("tmx2snes.exe (" TMX2SNESDATE ") version " TMX2SNESVERSION "");
printf("\nCopyright (c) 2022 Alekmaul\n");
}

Expand Down

0 comments on commit b067751

Please sign in to comment.