bmake.sh - utility to create make files for linux

BlitzMax Forums/BlitzMax Programming/bmake.sh - utility to create make files for linux

explosive(Posted 2011) [#1]
Hello altogether,

I mainly use linux as my favorite OS, but sadly the max IDE isn't working as smoothly as on mac or win. So I got used to geany, gedit or kwrite to edit my source codes. To compile my stuff I use the make utility and a simple script to create the make-file. It's not perfect but does it's job for me.
#! /bin/bash

echo "BMAX_PATH=/home/developer/bin/blitzmax" > makefile
echo "BMK=/bin/bmk" >> makefile
echo "BMKW=/binw/bmk" >> makefile
echo "MAKEDOCS=/bin/makedocs" >> makefile
echo "BMKOPTS=makeapp -d" >> makefile
echo "PWD=\$(shell pwd)" >> makefile
echo "" >> makefile

echo "all: " >> makefile

FILES=*
for f in $FILES
do
	if [ -f "$f" ]
	then
		lowercase=$(echo ${f##*.} | tr '[A-Z]' '[a-z]')
		if [ "$lowercase" = "bmx" ]
		then 
			echo "	\$(BMAX_PATH)\$(BMK) \$(BMKOPTS) -o \"\$(PWD)/${f%.*}\" \"\$(PWD)/$f\" " >> makefile
		fi
	fi
done

echo "win: " >> makefile
for f in $FILES
do
	if [ -f "$f" ]
	then
		lowercase=$(echo ${f##*.} | tr '[A-Z]' '[a-z]')
		if [ "$lowercase" = "bmx" ]
		then 
			echo "	\$(BMAX_PATH)\$(BMKW) \$(BMKOPTS) -l win32 -o \"\$(PWD)/${f%.*}\" \"\$(PWD)/$f\" " >> makefile
		fi
	fi
done

echo "clean: " >> makefile
echo "	rm -f \$(TARGET) " >> makefile
echo "" >> makefile
echo "modules: " >> makefile
echo "	\$(BMAX_PATH)\$(BMK) makemods \$(MODULE)" >> makefile 
echo "" >> makefile
echo "docs: " >> makefile
echo "	\$(BMAX_PATH)\$(MAKEDOCS)" >> makefile 
echo "" >> makefile
echo "run: " >> makefile
echo "	./\$(TARGET)" >> makefile


Save this file as "bmake.sh", copy it to "/usr/bin/" set you as the owner ("$ chown yourname /usr/bin/bmake.sh") and make it executable ("$ chmod +x /usr/bin/bmake.sh").

As a framework I used hamZta's makefile from the german forum: http://www.blitzforum.de/forum/viewtopic.php?t=35854&sid=58a6214d689a491b88feb9cdb6f969bb

Some simple explanations:
Edit the first lines so that the paths fit to your installation.
I still can't get brucey's NG-version of bmk running when it's in the same directory as the stuff used for cross-compiling. I then can make win32 executables but get an error when compiling linux stuff. So I made a second "bin" directory in my blitzmax installation.

use "make" to compile for linux and "make win" to compile for windows.

If this helps anyone, feel free to use it!

Greetings, Simon


Sub_Zero(Posted 2013) [#2]
Thanks for this


UNZ(Posted 2013) [#3]
I personally would prefer an IDE that does this stuff when I click a button. Feel free to try indevIDE Sub_Zero. Sure it is not as powerful as eclipse or blide but it works far better on linux than MaxIDE does.
But I admit that I never tried geany. Does it have BMax highlighting and advanced autocompletion (for user defined keywords)?