Geany

Since a specific dependency can be passed as parameter when the makefile is called I guess an IDE uses this to execute the required command. For example:

COMPILER = /usr/local/cris/bin/gcc-cris
CFLAGS = -mlinux -o
SOURCES = main.c
TARGET = Hello_World
DESTINATION = root@FOXBoard:/mnt/flash/bin/HelloWorld

# top-level rule to create the program, executed by default if no params are provided
all: compile

# Called by pressing the Compile or Build button in Geanny
compile: $(SOURCES)
$(COMPILER) $(CFLAGS) $(TARGET) $(SOURCES)

build: compile

scp $(TARGET) $(DESTINATION)

When the command make compile is executed, the code is only compiled. When the command make build it first executes the compile dependency and than copies the executable to the target. I would expect that the IDE provides the basic menu structure and allows the programmer to enter the command to execute when the menu item is selected. In that case, it’s easy to integrate custom compilers or special target needs in the default IDE.

After spending a hour searching how this works in Anjuta I could not find how to make this work. It might be that Anjuta is already to complex for what I want, it is designed for working with huge open source projects, in my case it will be a couple of local files that need to be managed.

Searching the internet for a simple Linux IDE results in several hits refering to Geany. The home page states “It was developed to provide a small and fast IDE, which has only a few dependencies from other packages”. Sounds like this is what I’m looking for. Using the Applications | Add/Remove… menu in Ubuntu shows that Geany can automaticly be installed.

After installation and starting Geany it is easy to find your way in this program. First guess is that I will be needing to setup a new project, using the Project | New menu option. It asks for a project name (HelloWorld), the file to store the project settings in (HelloWorld.geany) and the base folder of the project (/home/jan/FOXBoard/HelloWorld). After pressing the create button I can open the files that I already created before manually (main.c).

After opening the main.c file the Build menu options are enabled. Selection the Build | Compile menu command shows that gcc is used for compiling the application and that no errors are found. Nice, but I don’t want gcc but I want gcc-cris to be used, or actually I want that make is called with my own parameter.

In the Build menu there is an option available Set includes and arguments, selecting this option shows a dialog that offers three input fields to enter commands for Compile, Build and Execute. Here the gcc command is listed, I guess these commands are indeed given to Linux to execute so entering make compile in the Compile field, make build in the Build field and make build in the Execute field should do the trick. After pressing the OK button and selecting Build | Compile the Compiler shows in blue the execute command (make compile (in directory:/home/jan/FOXBoard/HelloWorld)) and the output of the make program (/usr/local/cris/bin/gcc-cris -mlinux -o Hello_World main.c). After a second a blue message indicates that the Compilation finished successfully. The Build | Build menu command or the Build | Execute command does the same with the addition of executing the secure copy as well.

In the Edit | Preferences menu you can select in the Toolbar tab the option to display a Compile and Run button. These buttons call the Build | Compile menu (and so make compile) and the Build | Execute menu (and so make build) to make life even more easy.

On purpose a mistake is made in main.c to check how errors are handled. The printf is replaced by pri ntf, after pressing compile it shows an error in the Compiler tab and highlights the error in main.c. Very, very nice! It looks like I found my base for the developing code, next step would be to include a debugger as well.

reference : animalrobots

0 komentar:

Posting Komentar