-
Chano
- Posts: 28
- Joined: Fri Dec 12, 2008 7:38 pm
Post
by Chano » Sat Oct 11, 2014 2:40 pm
Hi!
gba's devkitarm and tonc works great on mac, but tonc's gfxmake make grit output a header like this:
Code: Select all
-e //
// all_gfx.h
//
-e // One header to rule them and in the darkness bind them
-e // Date: 2014-10-11 15:29:42
-e #ifdef __cplusplus
extern "C" {
#endif
The same gfxmake works without problem on Windows.
Any idea?
Thanks.
-
Chano
- Posts: 28
- Joined: Fri Dec 12, 2008 7:38 pm
Post
by Chano » Sun Oct 12, 2014 11:58 am
This is the gfxmake, if it helps
Code: Select all
#
# Making a gfx library from grit output
#
# For use on data-arrays only. NO CODE!!!
#
# ---------------------------------------------------------------------
# SETUP
# ---------------------------------------------------------------------
export PATH := $(DEVKITARM)/bin:$(PATH)
# Put the path to grit here:
export GRIT ?= $(DEVKITARM)/bin/grit
.SUFFIXES:
include $(DEVKITARM)/base_rules
# ---------------------------------------------------------------------
# PROJECT DETAILS
# ---------------------------------------------------------------------
# GFXTITLE : Graphics library name
# BUILD : Directory for build process temporaries. Should NOT be empty!
# GFXDIRS : List of graphics directories
# GFXEXTS : Graphics extensions.
# General note: use . for the current dir, don't leave them empty.
BUILD := build
GFXDIRS := sprites images
GFXLIB ?= libgfx.a
GFXHDR ?= all_gfx.h
GFXEXTS := bmp
# --- Exceptions ---
# Add files/file-variables for special rules here. Put the rules
# At the bottom of the makefile. Be careful with directories, as
# we'll be in $(BUILD) when converting.
# GFXSPECIALS : removed from GFXFILES
# OSPECIALS : added to OFILES
# Key exception variables
# ---------------------------------------------------------------------
# BUILD FLAGS
# ---------------------------------------------------------------------
# Since there's no code to compile, we won't need optimizations,
# architectures etc.
CFLAGS :=
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS :=
# ---------------------------------------------------------------------
# BUILD PROCEDURE
# ---------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
# still in main directory.
export TARGET := $(CURDIR)/$(GFXLIB)
export VPATH := $(foreach dir, $(GFXDIRS), $(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
GFXFILES := $(filter-out $(GFXSPECIALS), \
$(foreach dir, $(GFXDIRS), \
$(foreach ext, $(GFXEXTS), \
$(notdir $(wildcard $(dir)/*.$(ext))) \
)))
export OFILES := $(addsuffix .o, $(basename $(GFXFILES))) $(OSPECIALS)
# --- More targets ----------------------------------------------------
.PHONY: $(BUILD) clean
# --- Create BUILD if necessary, and run this makefile from there ---
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/gfxmake
all : $(BUILD)
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET) $(GFXHDR)
# ---------------------------------------------------------------------
else
DEPENDS := $(OFILES:.o=.d)
.PHONY : all
all : $(TARGET) $(GFXHDR)
$(TARGET) : $(OFILES)
@echo Archiving into $(notdir $@)
-@rm -f $@
@$(AR) rcs $@ $(OFILES)
$(GFXHDR) : $(OFILES)
@echo "Creating master header: $@"
@$(call master-header, $@, $(notdir $(^:.o=.h)) )
# ---------------------------------------------------------------------
# BASE CONVERSION RULES
# ---------------------------------------------------------------------
# --- With separate .grit file ---
%.s %.h : %.png %.grit
$(GRIT) $< -fts
%.s %.h : %.bmp %.grit
$(GRIT) $< -fts
%.s %.h : %.pcx %.grit
$(GRIT) $< -fts
%.s %.h : %.jpg %.grit
$(GRIT) $< -fts
# --- Without .grit file ; uses dirname/dirname.grit for options ---
%.s %.h : %.png
$(GRIT) $< -fts -ff $(<D)/$(notdir $(<D)).grit
%.s %.h : %.bmp
$(GRIT) $< -fts -ff $(<D)/$(notdir $(<D)).grit
%.s %.h : %.pcx
$(GRIT) $< -fts -ff $(<D)/$(notdir $(<D)).grit
%.s %.h : %.jpg
$(GRIT) $< -fts -ff $(<D)/$(notdir $(<D)).grit
# ---------------------------------------------------------------------
# FUNCTIONS
# ---------------------------------------------------------------------
## Merge all headers into a single large one for easier including.
define master-header # $1 : master path, $2 separate header paths
echo -e "//\n// $(notdir $(strip $1))\n//" > $1
echo -e "// One header to rule them and in the darkness bind them" >> $1
echo -e "// Date: $(shell date +'%F %X' )\n" >> $1
echo -e "#ifdef __cplusplus\nextern \"C\" {\n#endif" >> $1
cat $2 >> $1
echo -e "\n#ifdef __cplusplus\n};\n#endif\n" >> $1
endef
## if you just want to include the separate headers, use this instead of cat:
# for hdr in $2 ; \
# do echo -e "#include \"$$hdr\"" >> $1 ; done;
# --- odds and ends ---
## Get the title-part of filename.
define title # $1: filepath
$(basename $(notdir $1))
endef
## Get a valid C identifier for a name.
define cident # $1: name
`echo $1 | sed -e 's|^\([0-9]\)|_\1| ; s|[./\\-]|_|g'`
endef
## Create a header file for a bin2s converted binary.
define bin-header # $1: path, $2: identifier
echo "extern const u32 $(strip $2)_size;" > $1
echo "extern const u8 $(strip $2)[];" >> $1
endef
# ---------------------------------------------------------------------
# DEPENDENCIES
# ---------------------------------------------------------------------
-include $(DEPENDS)
endif
-
elhobbs
- Posts: 358
- Joined: Thu Jul 02, 2009 1:19 pm
Post
by elhobbs » Mon Oct 13, 2014 2:34 pm
is the "-e" parameter for echo supported on a mac? is this used in your other makefiles?
-
Chano
- Posts: 28
- Joined: Fri Dec 12, 2008 7:38 pm
Post
by Chano » Mon Oct 13, 2014 6:41 pm
It seems that the "-e" arguments from some echo calls where unnecessary, so I have removed them and now it works!
Thanks a lot!
Who is online
Users browsing this forum: No registered users and 3 guests