[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
|
||||
|
||||
# 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 ##
|
||||
|
||||
|
|
|
@ -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 $<
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue