diff --git a/infrastructure-centred/owlps-listener/Makefile b/infrastructure-centred/owlps-listener/Makefile index 8defd28..a03a974 100644 --- a/infrastructure-centred/owlps-listener/Makefile +++ b/infrastructure-centred/owlps-listener/Makefile @@ -17,11 +17,13 @@ TARGET=owlps-listenerd HEADER=owlps-listener.h # Flags -CFLAGS=-O2 -W -Wall -Wstrict-prototypes -O -I. -DEPFLAGS=-MMD -XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) -PICFLAG=-fPIC -LIBS=-lm -lpcap -lpthread -lconfuse ../../libowlps/libowlps.so.1.0 +CFLAGS = -O2 -W -Wall -Wstrict-prototypes -O -I. +DEPFLAGS = -MMD +XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) +PICFLAG = -fPIC +OWLPSFLAGS = -D USE_CONFIG_FILE -lconfuse -D USE_PTHREAD -pthread +LIBS = -L../../libowlps -lowlps -lpcap -liw -lm +LDFLAGS = $(LIBS) $(OWLPSFLAGS) ## Cibles de compilation standard ## @@ -30,14 +32,15 @@ LIBS=-lm -lpcap -lpthread -lconfuse ../../libowlps/libowlps.so.1.0 all : $(TARGET) +# Cancel implicit make rule +%: %.c + % : %.o - $(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) + $(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) + %.o : %.c $(HEADER) $(CC) $(XCFLAGS) -c $< -# Compilation du programme -$(TARGET) : $(TARGET).o $(HEADER) - ## Installation / désinstallation ## diff --git a/infrastructure-centred/owlps-listener/Makefile_atheros b/infrastructure-centred/owlps-listener/Makefile_atheros index 0c710f7..dd2f0bb 100644 --- a/infrastructure-centred/owlps-listener/Makefile_atheros +++ b/infrastructure-centred/owlps-listener/Makefile_atheros @@ -23,32 +23,41 @@ TARGET=owlps-listenerd HEADER=owlps-listener.h # Flags -CFLAGS=-O2 -W -Wall -Wstrict-prototypes -O -I. -DEPFLAGS=-MMD -XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) -PICFLAG=-fPIC -LIBS = -lm -lpcap -liw +CFLAGS = -O2 -W -Wall -Wstrict-prototypes -O -I. +DEPFLAGS = -MMD +XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS) +PICFLAG = -fPIC +LIBS = -lpcap -liw -lm LOWLPS = -L../../libowlps -lowlps LOWLPSA = ../../libowlps/libowlps.a LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include +#OWLPSFLAGS = -D USE_CONFIG_FILE -lconfuse -D USE_PTHREAD -pthread +LDFLAGS = $(OWLPSFLAGS) $(LIBS) ## Cibles de compilation standard ## -.PHONY : all static semistatic install uninstall clean purge help +.PHONY: all dynamic semistatic static install uninstall clean purge help -all : $(TARGET) -static : $(TARGET).static -semistatic : $(TARGET).semistatic +dynamic: $(TARGET) +semistatic: $(TARGET).semistatic +static: $(TARGET).static +all: dynamic semistatic static -% : %.o - $(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(LOWLPS) $(IATHEROS) $(LATHEROS) -%.static : %.o - $(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(LOWLPS) $(IATHEROS) $(LATHEROS) -static -%.semistatic : %.o - $(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(LOWLPSA) $(IATHEROS) $(LATHEROS) -%.o : %.c $(HEADER) +# Cancel implicit make rule +%: %.c + +%: %.o + $(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LOWLPS) $(IATHEROS) $(LATHEROS) $(LDFLAGS) + +%.semistatic: %.o + $(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LOWLPSA) $(IATHEROS) $(LATHEROS) $(LDFLAGS) + +%.static: %.o + $(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LOWLPS) $(IATHEROS) $(LATHEROS) $(LDFLAGS) -static + +%.o: %.c $(HEADER) $(CC) $(XCFLAGS) $(IATHEROS) -c $< diff --git a/infrastructure-centred/owlps-listener/TODO b/infrastructure-centred/owlps-listener/TODO index 868626d..c4168ef 100644 --- a/infrastructure-centred/owlps-listener/TODO +++ b/infrastructure-centred/owlps-listener/TODO @@ -1,4 +1,3 @@ -* Makefile : utiliser des options passées au compilateur (gcc -D USE_PTHREAD) plutôt que des #define dans owlps-listener.h. * Fusionner Makefile et Makefile_atheros. * Éventuellement remplacer les options positives (USE_PTHREAD) par des options négatives (NO_USE_PTHREAD), en fonction des valeurs par défaut. * Permettre d'utiliser un nom d'hôte putôt qu'une IP pour le serveur d'agrégation. diff --git a/infrastructure-centred/owlps-listener/owlps-listener.h b/infrastructure-centred/owlps-listener/owlps-listener.h index 76d6735..af61ddd 100644 --- a/infrastructure-centred/owlps-listener/owlps-listener.h +++ b/infrastructure-centred/owlps-listener/owlps-listener.h @@ -5,9 +5,11 @@ #ifndef _AP_H #define _AP_H -// Compilation-time options (comment-out to unactivate) -#define USE_CONFIG_FILE // Use libconfuse to read a config file -#define USE_PTHREAD // POSIX threads available? +/* Compilation-time options: to activate, uncomment or compile with -D + * option. + */ +//#define USE_CONFIG_FILE // Use libconfuse to read a config file +//#define USE_PTHREAD // POSIX threads available? #define DEBUG