Add missing Makefiles for OpenWrt 10.03 (Backfire)

* libowlps, libowlps-client & owlps-listener:
Add Makefiles to compile for OpenWrt 10.03 (Backfire). (owlps-client had
one already.)

* libowlps & libowlps-client:
Update the Makefiles for OpenWrt 8.09 (Kamikaze).
This commit is contained in:
Matteo Cypriani 2011-06-15 10:36:47 +02:00
parent cce949f32a
commit 5364944c68
5 changed files with 339 additions and 8 deletions

View File

@ -1,8 +1,11 @@
# Emplacement de la suite de cross-compilation
TOOLCHAIN = $$HOME/openwrt/atheros/8.09/staging_dir
TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/8.09
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc4.1.2/bin
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/staging_dir/mips/usr
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/build_dir/mips/OpenWrt-SDK-atheros-for-Linux-i686/staging_dir/toolchain-mips_gcc4.1.2
# Compilateur
CC = $(TOOLCHAIN)/toolchain-mips_gcc4.1.2/bin/mips-linux-gcc
CC = $(TOOLCHAIN_BIN)/mips-linux-gcc
# Autres outils
AR = ar
@ -29,8 +32,8 @@ PICFLAG=-fPIC
LIBS=-liw
#STRIPFLAGS= -Wl,-s
#LDFLAGS=
LATHEROS=-L$(TOOLCHAIN)/mips/usr/lib/
IATHEROS=-I$(TOOLCHAIN)/mips/usr/include/
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
## Cibles de compilation standard ##

View File

@ -0,0 +1,75 @@
# Emplacement de la suite de cross-compilation
TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/10.03
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/staging_dir/target-mips_uClibc-0.9.30.1/usr
# Compilateur
CC = $(TOOLCHAIN_BIN)/mips-openwrt-linux-gcc
# Autres outils
AR = ar
RANLIB = ranlib
RM = rm -fv
# Variables générales
LIB_CIBLE=libowlps-client
VERSION=1.0
# Cibles à construire
STATIC=$(LIB_CIBLE).a
HEADER=owlps-client.h
# Composition de la bibliothèque
OBJS=$(LIB_CIBLE).o
# Flags
LIBOWLPS_DIR = ../libowlps
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O -I$(LIBOWLPS_DIR)
DEPFLAGS=-MMD
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG=-fPIC
LIBS=-liw
#STRIPFLAGS= -Wl,-s
#LDFLAGS=
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
## Cibles de compilation standard ##
.PHONY : all static clean purge help
all : static
static : $(STATIC)
%.o : %.c $(HEADER)
$(CC) $(XCFLAGS) $(IATHEROS) -c $<
# Compilation de la bibliothèque statique
$(STATIC) : $(OBJS)
$(RM) $@
$(AR) cru $@ $^
$(RANLIB) $@
## Nettoyage ##
clean :
@$(RM) *~ *.o *.d
purge : clean
@$(RM) $(STATIC)
## Aide ##
help :
@echo "Bibliothèques nécessaires à la compilation :\n\
libowlps-dev\n\
\n\
Cibles possibles :\n\
static (cible par défaut) : Compile la bibliothèque statique (.a).\n\
\n\
clean : Supprime les fichiers temporaires.\n\
purge : Supprime le résultat de la compilation.\n\"

View File

@ -1,5 +1,8 @@
# Emplacement de la suite de cross-compilation
TOOLCHAIN = $$HOME/openwrt/atheros/8.09/staging_dir
TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/8.09
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc4.1.2/bin
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/staging_dir/mips/usr
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/build_dir/mips/OpenWrt-SDK-atheros-for-Linux-i686/staging_dir/toolchain-mips_gcc4.1.2
# Répertoire d'installation
PREFIX=/usr/local
@ -8,7 +11,7 @@ INSTALL_INC= $(PREFIX)/include
INSTALL_MAN= $(PREFIX)/share/man
# Compilateur
CC = $(TOOLCHAIN)/toolchain-mips_gcc4.1.2/bin/mips-linux-gcc
CC = $(TOOLCHAIN_BIN)/mips-linux-gcc
# Autres outils
AR = ar
@ -41,8 +44,8 @@ PICFLAG=-fPIC
LIBS = -liw -lrt
#STRIPFLAGS= -Wl,-s
#LDFLAGS=
LATHEROS=-L$(TOOLCHAIN)/mips/usr/lib/
IATHEROS=-I$(TOOLCHAIN)/mips/usr/include/
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
## Cibles de compilation standard ##

View File

@ -0,0 +1,142 @@
# Emplacement de la suite de cross-compilation
TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/10.03
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/staging_dir/target-mips_uClibc-0.9.30.1/usr
# Répertoire d'installation
PREFIX=/usr/local
INSTALL_LIB= $(PREFIX)/lib
INSTALL_INC= $(PREFIX)/include
INSTALL_MAN= $(PREFIX)/share/man
# Compilateur
CC = $(TOOLCHAIN_BIN)/mips-openwrt-linux-gcc
# Autres outils
AR = ar
RANLIB = ranlib
# Commandes d'installation et de désinstallation
RM=rm -fv
CP=cp -v
SYMLINK=ln -svf
# Variables générales
LIB_CIBLE=libowlps
VERSION=1.0
# Cibles à construire
STATIC=$(LIB_CIBLE).a
DYNAMIC=$(LIB_CIBLE).so.$(VERSION)
#PROGS=
HEADER=owlps.h
#HEADERS=
# Composition de la bibliothèque
OBJS=$(LIB_CIBLE).o
# Flags
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes -O
DEPFLAGS=-MMD
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG=-fPIC
LIBS = -liw -lrt
#STRIPFLAGS= -Wl,-s
#LDFLAGS=
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
## Cibles de compilation standard ##
.PHONY : all dynamic static install install-dynamic install-static install-header uninstall uninstall-dynamic uninstall-static uninstall-header clean purge help
all : dynamic static
dynamic : $(DYNAMIC)
static : $(STATIC)
%.o: %.c $(HEADER)
$(CC) $(XCFLAGS) $(IATHEROS) $(PICFLAG) -c -o $@ $<
# Compilation de la bibliothèque dynamique
$(DYNAMIC): $(OBJS)
$(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) $(IATHEROS) $(LATHEROS) -lc $^
$(SYMLINK) $@ $(LIB_CIBLE).so
chmod a-x $@
# Compilation de la bibliothèque statique
$(STATIC): $(OBJS)
$(RM) $@
$(AR) cru $@ $^
$(RANLIB) $@
## Installation ##
install : install-static install-dynamic
install-dynamic : install-header $(DYNAMIC)
@$(CP) $(DYNAMIC) $(INSTALL_LIB) &&\
chmod 644 $(INSTALL_LIB)/$(DYNAMIC) &&\
chown root:root $(INSTALL_LIB)/$(DYNAMIC) &&\
cd $(INSTALL_LIB) && $(SYMLINK) $(DYNAMIC) $(LIB_CIBLE).so &&\
echo "Reconstruction du cache pour ld.so : ldconfig $(INSTALL_LIB)" ; ldconfig $(INSTALL_LIB)
install-static : install-header $(STATIC)
@$(CP) $(STATIC) $(INSTALL_LIB) &&\
chmod 644 $(INSTALL_LIB)/$(STATIC) &&\
chown root:root $(INSTALL_LIB)/$(STATIC)
install-header : $(HEADER)
@$(CP) $(HEADER) $(INSTALL_INC) &&\
chmod 644 $(INSTALL_INC)/$(HEADER) &&\
chown root:root $(INSTALL_INC)/$(HEADER)
## Désinstallation ##
uninstall : uninstall-dynamic uninstall-static
uninstall-dynamic : uninstall-header
@$(RM) $(INSTALL_LIB)/$(DYNAMIC) $(INSTALL_LIB)/$(LIB_CIBLE).so
@echo "Reconstruction du cache pour ld.so : ldconfig" ; ldconfig
uninstall-static : uninstall-header
@$(RM) $(INSTALL_LIB)/$(STATIC)
uninstall-header :
@$(RM) $(INSTALL_INC)/$(HEADER)
## Nettoyage ##
clean :
@$(RM) *~ *.o *.d
purge : clean
@$(RM) $(DYNAMIC) *.so $(STATIC) $(PROGS)
## Aide ##
help :
@echo "Bibliothèques nécessaires à la compilation :\n\
libiw-dev\n\
\n\
Cibles possibles :\n\
all (cible par défaut) : Compile la bibliothèque et le programme d'exemple (tx).\n\
dynamic : Compile la bibilothèque partagée (.so).\n\
static : Compile la bibliothèque statique (.a).\n\
\n\
install : Installe la bibliothèque partagée et statique.\n\
install-dynamic : N'installe que la bibliothèque partagée.\n\
install-static : N'installe que la bibliothèque statique.\n\
\n\
uninstall : Désinstalle tout ce qu'il est possible de désinstaller.\n\
uninstall-dynamic : Désinstalle la bibliothèque partagée.\n\
uninstall-static : Désinstalle la bibliothèque statique.\n\
\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."

View File

@ -0,0 +1,108 @@
# Source version
ifndef OWLPS_VERSION
OWLPS_VERSION := $(shell git describe 2>/dev/null || echo 'UNKNOWN_VERSION')
endif
# Emplacement de la suite de cross-compilation
TOOLCHAIN_PREFIX = $$HOME/openwrt/atheros/10.03
TOOLCHAIN_BIN = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/bin
TOOLCHAIN_USR = $(TOOLCHAIN_PREFIX)/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr
TOOLCHAIN_USR_2 = $(TOOLCHAIN_PREFIX)/staging_dir/target-mips_uClibc-0.9.30.1/usr
# 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 = $(TOOLCHAIN_BIN)/mips-openwrt-linux-gcc
# Commandes d'installation et de désinstallation
RM=rm -fv
CP=cp -v
# Cible
TARGET=owlps-listenerd
HEADER=owlps-listener.h
# Flags
LIBOWLPS_DIR = ../libowlps
LIBOWLPSCLIENT_DIR = ../libowlps-client
CFLAGS = -O2 -Wall -Wextra -Wstrict-prototypes \
-I$(LIBOWLPS_DIR) -I$(LIBOWLPSCLIENT_DIR)
DEPFLAGS = -MMD
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG = -fPIC
LOWLPS = -L$(LIBOWLPS_DIR) -lowlps
LOWLPSA = $(LIBOWLPS_DIR)/libowlps.a
LOWLPSCLIENTA = $(LIBOWLPSCLIENT_DIR)/libowlps-client.a
LIBS = -lpcap -liw -lm $(LOWLPSCLIENTA)
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\" \
-D USE_PTHREAD -pthread
#OWLPSFLAGS += -D USE_CONFIG_FILE -lconfuse
LDFLAGS = $(OWLPSFLAGS) $(LIBS)
## Cibles de compilation standard ##
.PHONY: all dynamic semistatic static install uninstall clean purge help
dynamic: $(TARGET)
semistatic: $(TARGET).semistatic
static: $(TARGET).static
all: dynamic semistatic static
# 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) $(OWLPSFLAGS) -c $<
## 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) $(TARGET).static $(TARGET).semistatic
## Aide ##
help :
@echo -e "Bibliothèques nécessaires à la compilation :\n\
libpcap0.8-dev\n\
libowlps1.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."