--==--
Nous allons aborder l'utilisation de projets crabs_makefile par l'exemple. Dans ce premier chapitre, nous allons créer un projet contenant un simple binaire.
# cd un_dossier_de_travail
La nous créons la racine du projet
# mkdir PROJET1
On termine la préparation
# cd PROJET1
# Pcourant
# mkdir SRC
Ne pas changer le nom de ce dossier
# PinfoGPL.sh
saisir les infos pour cet exercice
# cd $PROJET/SRC
Perso j'ai un alias pour cette commande...
# vi Makefile
Ou tout autre éditeur de texte
SHELL=/bin/sh BIN=projet1_bin SRC=main.c LD=gcc include $(PROJET_MK)/include.$(OS)
# vi main.c
#include <stdio.h>
int main( int argc, char** argv )
{
printf( "Hello world !!!\n" ) ;
return 0 ;
}
# make
--(Pdepend main.c)-- --- C: main.c -=> Edition des liens: projet1_bin == BIN: projet1_bin
# cd $PROJET/BIN/$OS/NORMAL
# ls -l
total 12 -rwxr-xr-x 1 crabs famille 11195 2005-11-05 12:08 projet1_bin*
Vérification de la signature
# Pinfo projet1_bin
05/11/2005 12:08:58 LINUX NORMAL crabs tuto 1 projet1_bin
On lance...
# ./projet_bin
Hello world !!!
# cd $PROJET/SRC
# make VARIANT=DEBUG
--(Pdepend main.c)-- --- C: main.c -=> Edition des liens: projet1_bin == BIN: projet1_bin
# cd $PROJET/BIN/$OS/DEBUG
# Pinfo projet1_bin
05/11/2005 12:27:22 LINUX DEBUG crabs tuto 1 projet1_bin
# gdb projet1_bin
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-slackware-linux"...Using host libthread_db
library "/lib/libthread_db.so.1".
(gdb) list
1 #include <stdio.h>
2
3 int main( int argc, char** argv )
4 {
5 printf( "Hello world !!!\n" ) ;
6 return 0 ;
7 }
8
(gdb)
Vous préciserez autant de source que nécessaire dans la variable SRC du Makefile.
Le chapitre suivant "Plusieurs Binaires : introduction aux dossiers" va vous permettre de découvrir la structure des dossiers gérés par crabs_makefile.