Rev 14 | Rev 59 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#
# Author: M. Curti
#
# Makefile
#************************************************
#* PARAMETRI *
#************************************************
# versione debug: yes/no
DEBUG_VERSION = yes
#************************************************
#* DIRECTORY/FILE *
#************************************************
WORK_DIR = .
PROJECT_DIR = ../$(WORK_DIR)
INC = $(PROJECT_DIR)/INC
SRC = $(PROJECT_DIR)/SRC
DEST_DIR = $(PROJECT_DIR)/bin
# se e' previsto il debug verrĂ creato il file nomefile_d.bin:
ifeq ($(DEBUG_VERSION),yes)
OUT_FILE = exe_d.bin
else
OUT_FILE = exe.bin
endif
#************************************************
#* COMANDI *
#************************************************
#compilatore
CC = gcc
#linker: inutile, uso gcc anche x linkare
LD = ld
#copia
CP = cp
#rimozione
RM = rm -f
#************************************************
#* PATH DI RICERCA PER INCLUDE FILES *
#************************************************
INCLUDES = -I$(INC) \
#************************************************
#* OPZIONI COMPILATORE E LINKER *
#************************************************
#### opzioni di compilazione per versione release (impianto):
#-c Compile or assemble the source files, but do not link. The linking stage simply is not done.
# The ultimate output is in the form of an object file for each source file.
#-Wall generate warnings for everything0
#-DLINUX so Linux
# -m32/m64 indica per qual architettura compilare (32 o 64 bit per sizeof int)
CFLAGS = -c $(INCLUDES) -DLINUX -Wall
#### opzioni di compilazione aggiuntive per versione debug o simulato:
#-g Produce debugging information
#-ggdb Produce debugging information for use by GDB
#-DDEBUG trace info di debug
#per debug:
ifeq ($(DEBUG_VERSION),yes)
CFLAGS += -g -ggdb -DDEBUG
endif
#### opzioni generali di linker:
# -lpcap link alla libreria pcap
LDFLAGS = -lpcap -lm
#************************************************
#* ENTRY POINT DEL MAKEFILE *
#************************************************
all: exe
#************************************************
#* TARGET DEL MAKEFILE *
#************************************************
clean:
$(RM) $(DEST_DIR)/$(OUT_FILE)
obj:
@echo +----------------------------------------------------------------------------------------------------------------------+
@echo +----------------------------------------------------------------------------------------------------------------------+
$(CC) -DMASKING $(CFLAGS) $(SRC)/*.c
@echo +---------------------+
@echo + All obj created
@echo +---------------------+
exe: obj
$(CC) *.o $(LDFLAGS) -o $(OUT_FILE)
@echo +---------------------+
@echo + Link OK, exe OK
@echo +---------------------+
# $(CP) $(OUT_FILE) $(DEST_DIR)
$(RM) *.o
# $(RM) $(OUT_FILE)