[Listener] Use compiler option -D
Fix Makefiles to use -D to activate the use of pthreads and libconfuse. Comment out #defines in owlps-listener.h. Fix lib order (needed for the static target).
This commit is contained in:
parent
bd789cd4a1
commit
12cf7e7cda
|
@ -17,11 +17,13 @@ TARGET=owlps-listenerd
|
||||||
HEADER=owlps-listener.h
|
HEADER=owlps-listener.h
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
CFLAGS=-O2 -W -Wall -Wstrict-prototypes -O -I.
|
CFLAGS = -O2 -W -Wall -Wstrict-prototypes -O -I.
|
||||||
DEPFLAGS=-MMD
|
DEPFLAGS = -MMD
|
||||||
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
PICFLAG=-fPIC
|
PICFLAG = -fPIC
|
||||||
LIBS=-lm -lpcap -lpthread -lconfuse ../../libowlps/libowlps.so.1.0
|
OWLPSFLAGS = -D USE_CONFIG_FILE -lconfuse -D USE_PTHREAD -pthread
|
||||||
|
LIBS = -L../../libowlps -lowlps -lpcap -liw -lm
|
||||||
|
LDFLAGS = $(LIBS) $(OWLPSFLAGS)
|
||||||
|
|
||||||
|
|
||||||
## Cibles de compilation standard ##
|
## Cibles de compilation standard ##
|
||||||
|
@ -30,14 +32,15 @@ LIBS=-lm -lpcap -lpthread -lconfuse ../../libowlps/libowlps.so.1.0
|
||||||
|
|
||||||
all : $(TARGET)
|
all : $(TARGET)
|
||||||
|
|
||||||
|
# Cancel implicit make rule
|
||||||
|
%: %.c
|
||||||
|
|
||||||
% : %.o
|
% : %.o
|
||||||
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
%.o : %.c $(HEADER)
|
%.o : %.c $(HEADER)
|
||||||
$(CC) $(XCFLAGS) -c $<
|
$(CC) $(XCFLAGS) -c $<
|
||||||
|
|
||||||
# Compilation du programme
|
|
||||||
$(TARGET) : $(TARGET).o $(HEADER)
|
|
||||||
|
|
||||||
|
|
||||||
## Installation / désinstallation ##
|
## Installation / désinstallation ##
|
||||||
|
|
||||||
|
|
|
@ -23,32 +23,41 @@ TARGET=owlps-listenerd
|
||||||
HEADER=owlps-listener.h
|
HEADER=owlps-listener.h
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
CFLAGS=-O2 -W -Wall -Wstrict-prototypes -O -I.
|
CFLAGS = -O2 -W -Wall -Wstrict-prototypes -O -I.
|
||||||
DEPFLAGS=-MMD
|
DEPFLAGS = -MMD
|
||||||
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
PICFLAG=-fPIC
|
PICFLAG = -fPIC
|
||||||
LIBS = -lm -lpcap -liw
|
LIBS = -lpcap -liw -lm
|
||||||
LOWLPS = -L../../libowlps -lowlps
|
LOWLPS = -L../../libowlps -lowlps
|
||||||
LOWLPSA = ../../libowlps/libowlps.a
|
LOWLPSA = ../../libowlps/libowlps.a
|
||||||
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
|
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
|
||||||
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
|
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 ##
|
## 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)
|
dynamic: $(TARGET)
|
||||||
static : $(TARGET).static
|
semistatic: $(TARGET).semistatic
|
||||||
semistatic : $(TARGET).semistatic
|
static: $(TARGET).static
|
||||||
|
all: dynamic semistatic static
|
||||||
|
|
||||||
% : %.o
|
# Cancel implicit make rule
|
||||||
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(LOWLPS) $(IATHEROS) $(LATHEROS)
|
%: %.c
|
||||||
%.static : %.o
|
|
||||||
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(LOWLPS) $(IATHEROS) $(LATHEROS) -static
|
%: %.o
|
||||||
%.semistatic : %.o
|
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LOWLPS) $(IATHEROS) $(LATHEROS) $(LDFLAGS)
|
||||||
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(LOWLPSA) $(IATHEROS) $(LATHEROS)
|
|
||||||
%.o : %.c $(HEADER)
|
%.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 $<
|
$(CC) $(XCFLAGS) $(IATHEROS) -c $<
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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.
|
* 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.
|
* É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.
|
* Permettre d'utiliser un nom d'hôte putôt qu'une IP pour le serveur d'agrégation.
|
||||||
|
|
|
@ -5,9 +5,11 @@
|
||||||
#ifndef _AP_H
|
#ifndef _AP_H
|
||||||
#define _AP_H
|
#define _AP_H
|
||||||
|
|
||||||
// Compilation-time options (comment-out to unactivate)
|
/* Compilation-time options: to activate, uncomment or compile with -D
|
||||||
#define USE_CONFIG_FILE // Use libconfuse to read a config file
|
* option.
|
||||||
#define USE_PTHREAD // POSIX threads available?
|
*/
|
||||||
|
//#define USE_CONFIG_FILE // Use libconfuse to read a config file
|
||||||
|
//#define USE_PTHREAD // POSIX threads available?
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue