76 lines
1.6 KiB
Makefile
76 lines
1.6 KiB
Makefile
|
# Répertoire d'installation
|
||
|
PREFIX=/usr/local
|
||
|
INSTALL_DIR= $(PREFIX)/sbin
|
||
|
INSTALL_LIB= $(PREFIX)/lib
|
||
|
INSTALL_INC= $(PREFIX)/include
|
||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||
|
|
||
|
# Compilateur
|
||
|
CC = gcc
|
||
|
|
||
|
# Commandes d'installation et de désinstallation
|
||
|
RM=rm -fv
|
||
|
CP=cp -v
|
||
|
|
||
|
# Cible
|
||
|
TARGET=apd
|
||
|
HEADER=ap.h
|
||
|
|
||
|
# Flags
|
||
|
CFLAGS=-O2 -W -Wall -Wstrict-prototypes -I.
|
||
|
DEPFLAGS=-MMD
|
||
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||
|
PICFLAG=-fPIC
|
||
|
LIBS=-lm -lpcap ../librtaputil/librtaputil.so.1.0
|
||
|
|
||
|
|
||
|
## Cibles de compilation standard ##
|
||
|
|
||
|
.PHONY : all install uninstall clean purge help
|
||
|
|
||
|
all : $(TARGET)
|
||
|
|
||
|
% : %.o
|
||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
||
|
%.o : %.c $(HEADER)
|
||
|
$(CC) $(XCFLAGS) -c $<
|
||
|
|
||
|
# Compilation du programme
|
||
|
$(TARGET) : $(TARGET).o $(HEADER)
|
||
|
|
||
|
|
||
|
## Installation / désinstallation ##
|
||
|
|
||
|
install : $(TARGET)
|
||
|
@$(CP) $(TARGET) $(INSTALL_DIR)
|
||
|
@cd $(INSTALL_DIR) ; chown root:root $(TARGET) ; chmod 755 $(TARGET)
|
||
|
|
||
|
uninstall :
|
||
|
@$(RM) $(INSTALL_DIR)/$(TARGET)
|
||
|
|
||
|
|
||
|
## Nettoyage ##
|
||
|
|
||
|
clean :
|
||
|
@$(RM) -fv *~ *.o *.d
|
||
|
|
||
|
purge : clean
|
||
|
@$(RM) -fv $(TARGET)
|
||
|
|
||
|
|
||
|
## Aide ##
|
||
|
|
||
|
help :
|
||
|
@echo "Bibliothèques nécessaires à la compilation :\n\
|
||
|
libpcap0.8-dev\n\
|
||
|
librtaputil1.0 (fournie)\n\
|
||
|
\n\
|
||
|
Cibles possibles :\n\
|
||
|
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
|
||
|
install : Installe le programme $(TARGET).\n\
|
||
|
uninstall : Désinstalle le programme $(TARGET).\n\
|
||
|
clean : Supprime les fichiers temporaires.\n\
|
||
|
purge : Supprime le résultat de la compilation.\n\
|
||
|
\n\
|
||
|
Note : l'installation se fait dans l'arborescence $(PREFIX). Modifiez la variable PREFIX du Makefile pour changer ce comportement."
|