#10365 - marcmccann - Wed Sep 03, 2003 2:14 pm
If any of you are getting sick of writing batch files, I have made myself a batch file generator to do it for me. If any of you people might find this useful and want it, could you please post it on here and if i get enough replies I will neaten up the code and the program itself and just give it all out on the tools section for you to have a mess around with and use
_________________
The GBA is one Lean and Mean machine!
#10371 - antysix - Wed Sep 03, 2003 3:40 pm
Well, why not!
For my projects I use the most simplistic batch file without any optimizations or anything and I'm actually too lazy to get into that compiler stuff so I do want to try it.
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age
Currently developping: Project ~ [ Phail ]
#10372 - marcmccann - Wed Sep 03, 2003 3:51 pm
sounds like me! I hate having to mess around with things for it to work, this is a really basic program I knocked up in VB in about 10 minutes and it saves me a hell of a lot of time!
Anyone else interested?
_________________
The GBA is one Lean and Mean machine!
#10374 - Lupin - Wed Sep 03, 2003 4:36 pm
VB is neat for tools, I wrote an BIT->DEC/HEX converter (and wise-versa) in VB.
I also wrote an cool gfx-converter and map editor, but I lost everything because my HDD did crash :(((
As soon as I'm able to get some webspace I'll create an website where you could dload my tool too.
Anyone knows an good webhost? (4 free ^^)
#10375 - tepples - Wed Sep 03, 2003 4:58 pm
If you need hosting, and your project is OSI Certified(sm) open source software, try SourceForge.net.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#10387 - Lupin - Wed Sep 03, 2003 8:10 pm
yeah, I know sourceforge.net... but even though my stuff is all open source I have no real project, I'm coding various things (and most likely I won't ever finish something ^^), my main projects are Quake3 BSP renderer written in VB w/ DX, Q2/Q3 model Renderer in VB w/ DX, GBA programming stuff (my goal is to write something which looks like some kind of 3d :D)
But I think I'll just create an Main site for my Q3 BSP renderer and then add an sub-site wich is actually my main site with all the other stuff ^^
#10408 - marcmccann - Thu Sep 04, 2003 9:44 am
VB is great for tools, it takes all the time out of coding a windows application and lets you get straight to the the point with what you want to do rather than messing with all your windows classes etc like u would in c++. The only drawback I have is when I want to distribute my programs because some people don't have the VB runtimes installed on thir machines. Other than that it is by far the best tool writing language.
Anyhows back to the main point. Is anyone interested in this Batch file maker?
_________________
The GBA is one Lean and Mean machine!
#10421 - Lupin - Thu Sep 04, 2003 2:38 pm
yeah, vb runtimes really suck :(
Would be cool if there'd be an way to only take the functions out of the runtime which my application really needs and link them into the exe (without linking the whole dll into the exe and creating something like an self-extracting archive - that's what some tools tend to do...)
#10422 - col - Thu Sep 04, 2003 2:45 pm
marcmccann wrote: |
If any of you are getting sick of writing batch files, I have made myself a batch file generator to do it for me. If any of you people might find this useful and want it, could you please post it on here and if i get enough replies I will neaten up the code and the program itself and just give it all out on the tools section for you to have a mess around with and use |
what are these batch files doing exactly?
are they just to switch to the correct folder and then run make with your makefile?
or are they replacing the makefile?
or are they doing something else?
I would love a batchfile generator that just knew what i wanted to do, and wrote a batch file to do it for me ;)
cheers
col.
#10438 - tepples - Thu Sep 04, 2003 8:14 pm
Here's how the most basic batch file generator would work.
For each file in the current directory whose name ends in .c, .cpp, .s, or .S, make a 'gcc' command line that compiles it. If the name contains "iwram" then compile it as ARM and name it as ###.iwram.o; otherwise compile it as Thumb and name it as ###.o where ### is a unique 3-digit number. Then make a 'gcc' command line that links all the .o files together. (Make this 'g++' instead of 'gcc' if one of the files was a .cpp file.)
There are more sophisticated programs that can generate a makefile automatically; look at automake
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#10459 - col - Fri Sep 05, 2003 4:46 pm
tepples wrote: |
Here's how the most basic batch file generator would work.
For each file in the current directory whose name ends in .c, .cpp, .s, or .S, make a 'gcc' command line that compiles it. If the name contains "iwram" then compile it as ARM and name it as ###.iwram.o; otherwise compile it as Thumb and name it as ###.o where ### is a unique 3-digit number. Then make a 'gcc' command line that links all the .o files together. (Make this 'g++' instead of 'gcc' if one of the files was a .cpp file.)
There are more sophisticated programs that can generate a makefile automatically; look at automake |
I kind of figured that was what it was about - i wasn't sure though :)
My makefile handles all of that stuff automatically - so no need for batch files! I tell the make file which directories to search and it handles the rest. I can just write some new source and save it to the correct folder, and everything works :))
It also handles dependencies.
I've been intending to 'release' it for a while, but there is a little annoyance that i would like to try and solve first - if I remove a source file from the project I have to remove the dependency file for that source file as well, or I get errors. I think it will be pretty easy to fix, just havn't got around to it yet.
Also, I'm fairly certain that it uses features unique to gnu make, and you will need to add sed to the bin utils (devkitadv dosn't have sed)
If people are interested, i can post it annoyance and all?
cheers
Col
#10466 - crossraleigh - Fri Sep 05, 2003 9:43 pm
col wrote: |
If people are interested, i can post it annoyance and all?
|
I sort of like looking at other peoples hand-written makefiles. Each person builds a little bit different, and each Makefile has a neat little idea that another doesn't.
What are the things (all of) your makefiles do?
#10702 - col - Sat Sep 13, 2003 1:07 am
ok here goes - if anyone tries using this, please tell me how you get on
[edit] updated to new version that handles the tidying up of old .o and .d files
Code: |
#=========================================================================
#
# ----------------------------
# |makefile by Colin Brown 2003|
# ----------------------------
#
# To use this makefile:
# replace the dummy entries for NAME, SRCDIRS, INCLUDES and LIBS
# with those from your project.
# set your favourite flags for the compiler, linker and assembler
# thats about it.
#
#
#==========================================================================
# name of project
NAME = myGame
# list of folders that contain source
# remember - all source files in these folders will be compiled
# so don't leave any junk in there!
SRCDIRS = ./ \
./mySourceFolder/ \
./myOtherSourceFolder/ \
./yetAnotherSourceFolder/
# include paths
INCLUDES = -I ../libFolder/inc/ \
-I ./myheaderFolder/
# Library paths.
LIBS = -L ../libFolder/myLibs/ \
-L ../libFolder/someOtherLibs/
# flags: put your favourite compiler options here
CFLAGSCOMMON = -c -fno-rtti -nostartfiles -nostdlib \
-nodefaultlibs -fno-exceptions -fomit-frame-pointer \
-mcpu=arm7tdmi -frename-registers #-fverbose-asm -save-temps
CFLAGSARM = -marm -mthumb-interwork -O2 $(CFLAGSCOMMON)
CFLAGSTHUMB = -mthumb -mthumb-interwork -O2 $(CFLAGSCOMMON)
DEFAULT = $(CFLAGSTHUMB)
ASFLAGS = -mthumb-interwork
MAP = map.out
LDFLAGS = -mthumb-interwork -Xlinker -Map $(MAP)
# tools
CROSS = arm-agb-elf-
CC = $(CROSS)gcc
AS = $(CROSS)as
LD = $(CROSS)gcc
# Name of output targets
ELF = $(NAME).elf
TARGET = $(NAME).gba
# declare which sufixes are source files
SUFFIX_TYPES = .s .c .arm.c .thumb.c .cpp .arm.cpp .thumb.cpp
# generate a list of all the source files in the source folders
# (sort removes pesky duplicates)
SRC_FILES = $(sort \
$(foreach SRCDIR, $(SRCDIRS), \
$(foreach SUFFIX_TYPE, $(SUFFIX_TYPES), \
$(wildcard $(SRCDIR)*$(SUFFIX_TYPE)) \
) \
) \
)
# turn all suffixes to .o
SRC = $(foreach SRC_FILE, $(SRC_FILES), $(basename $(SRC_FILE)).o)
#now a list all existing .o and .d that we need for housekeeping
PRODUCTS = $(sort \
$(foreach SRCDIR, $(SRCDIRS), \
$(wildcard $(SRCDIR)*.o) \
$(wildcard $(SRCDIR)*.d) \
) \
)
# now for the build rules.
game: $(TARGET)
@rm -f $(filter-out $(SRC) $(SRC:.o=.d), $(PRODUCTS) ) #tidy up any old files
# this is a nasty hack so i can use rebuildAll in vc++ to clean !
# if anyone knows a better way please tell me :)
all: clean
clean:
rm -f $(foreach SRCDIR, $(SRCDIRS), $(wildcard $(SRCDIR)*.o) $(wildcard $(SRCDIR)*.d))
rm -f $(TARGET) $(ELF) $(SYMBOLS) $(MAP)
rm -f *.o *.d
# it's important to leave the -MD -MP in there
# they generate our dependency information
# the -MP option is only available in gcc 3.x and later
# for similar functionality see the paper:
# "Advanced Auto-Dependency Generation" by Paul D. Smith
%.o: %.s
$(AS) $(ASFLAGS) -o $@ $<
%.o: %.c
$(CC) $(INCLUDES) $(DEFAULT) -MD -MP -o $@ $<
%.o: %.cpp
$(CC) $(INCLUDES) $(DEFAULT) -MD -MP -o $@ $<
%.thumb.o: %.thumb.cpp
$(CC) $(INCLUDES) $(CFLAGSTHUMB) -MD -MP -o $@ $<
%.arm.o: %.arm.cpp
$(CC) $(INCLUDES) $(CFLAGSARM) -MD -MP -o $@ $<
%.thumb.o: %.thumb.c
$(CC) $(INCLUDES) $(CFLAGSTHUMB) -MD -MP -o $@ $<
%.arm.o: %.arm.c
$(CC) $(INCLUDES) $(CFLAGSARM) -MD -MP -o $@ $<
$(ELF): $(SRC)
touch $(MAP)
$(LD) $(LDFLAGS) -o $@ $(SRC) $(LIBS) -lstdc++
$(CROSS)size $@
$(TARGET): $(ELF)
$(CROSS)objcopy -v -O binary $< $@
# include the dependency information
-include $(SRC:.o=.d)
|
cheers
Col
Last edited by col on Sun Sep 14, 2003 3:31 am; edited 1 time in total
#10734 - col - Sat Sep 13, 2003 3:49 pm
I edited the above post with a new version of the makefile.
the problem of having to manually tidy up .o and .d files when removing source files from a project should be gone.
fixed another bug related to changing source files from arm to thumb.
I hope now that this really is an automatic makefile :)
scans folders and compiles all source files found
keeps track of all dependencies including .h files
compatible with devkitadv version 5
cheers
Col
#10774 - Ruiner - Mon Sep 15, 2003 7:07 am
Figured I would throw this in since it took me forever to find the choice equivalent in Windows XP. This does a little batch file menu. I usually leave the batch running when Im fixing bugs and just switch back to it and hit 1 to compile and execute the rom. The batch also doesnt close immediatly so I can see errors in compilation and such.
Code: |
:: Please feel free to use this and modify it however you need.
:: It took me AGES to figure out how WinXP replaced the old dos
:: choice command.
@ECHO OFF
path=%path%;c:\devkitadv;c:\devkitadv\bin;c:\devkitadv\tools
CLS
:LOOP
ECHO COMPILE MENU
ECHO ----------------------
ECHO 1: Compile and EXECUTE
ECHO 2: Compile and DEBUG
ECHO 3: Compile and CLEAN
ECHO 4: Compile
ECHO 5: Quit
ECHO ----------------------
ECHO Written by Ruiner
ECHO.
:: Set is the WinXP equivalent of choice.
SET Choice=
SET /P Choice=[Choice]:
:: The next line gets a substring starting at 0 and 1 char long
IF NOT '%Choice%'=='' SET Choice=%Choice:~0,1%
ECHO.
CLS
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='1' GOTO Item1
IF /I '%Choice%'=='2' GOTO Item2
IF /I '%Choice%'=='3' GOTO Item3
IF /I '%Choice%'=='4' GOTO ITEM4
IF /I '%Choice%'=='5' GOTO End
ECHO "%Choice%" is not a menu option.
ECHO.
GOTO Loop
:: --------------------------------------------
:Item1
make run clean
GOTO Again
:: --------------------------------------------
:Item2
make all debug
GOTO Again
:: --------------------------------------------
:Item3
make all clean
GOTO Again
:: --------------------------------------------
:Item4
make
GOTO Again
:: --------------------------------------------
:Again
ECHO.
ECHO.
PAUSE
CLS
GOTO Loop
:End
|