Skip to content

Commit

Permalink
Merge pull request #193 from kobenairb/makefile_bin2txt
Browse files Browse the repository at this point in the history
bin2txt: Remove extra new line when version is printed, optimize Makefile as well
  • Loading branch information
RetroAntho committed Apr 10, 2023
2 parents 0f6165c + 1bb323c commit a7b68f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
43 changes: 19 additions & 24 deletions tools/bin2txt/Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
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="\"$(DATESTRING)\"" -D__BUILD_VERSION="\"$(VERSION)\""

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

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


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

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

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


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

install: all
@cp $(EXE)$(EXT) ../../devkitsnes/tools/$(EXE)$(EXT)

install:
cp $(EXE)$(EXT) ../../devkitsnes/tools/$(EXE)$(EXT)
.PHONY: all clean install
6 changes: 3 additions & 3 deletions tools/bin2txt/bin2txt.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
---------------------------------------------------------------------------------*/

#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define BIN2TXTVERSION __BUILD_VERSION
#define BIN2TXTDATE __BUILD_DATE

//// M A I N V A R I A B L E S ////////////////////////////////////////////////
int convformat = 1; // conversion formation (1=c , 2 = asm)
int quietmode = 0; // 0 = not quiet, 1 = i can't say anything :P
int quietmode = 0; // 0 = not quiet, 1 = i can't say anything :P
FILE *fpi, *fpo; // input and output file handler
unsigned int filesize; // input file size
char filebase[256] = ""; // input filename
Expand Down Expand Up @@ -75,7 +75,7 @@ void PrintOptions(char *str)
//////////////////////////////////////////////////////////////////////////////
void PrintVersion(void)
{
printf("\n\nbin2txt.exe (" BIN2TXTDATE ") version " BIN2TXTVERSION "");
printf("bin2txt.exe (" BIN2TXTDATE ") version " BIN2TXTVERSION "");
printf("\nCopyright (c) 2012-2021 Alekmaul\n");
}

Expand Down

0 comments on commit a7b68f0

Please sign in to comment.