Makefile Atheros (listener & libowlps)
Last (uncommited) changes in the SVN repo (2/2): - Add/modify Makefile_atheros for libowlps and owlps-listener.
This commit is contained in:
parent
f8ff9f6794
commit
257837962e
|
@ -1,5 +1,8 @@
|
||||||
# Emplacement de la suite de cross-compilation
|
# Emplacement de la suite de cross-compilation
|
||||||
TOOLCHAIN = /home/banc/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
|
# Répertoire d'installation
|
||||||
PREFIX=/usr/local
|
PREFIX=/usr/local
|
||||||
|
@ -9,7 +12,7 @@ INSTALL_INC= $(PREFIX)/include
|
||||||
INSTALL_MAN= $(PREFIX)/share/man
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
# Compilateur
|
# Compilateur
|
||||||
CC = $(TOOLCHAIN)/toolchain-mips_gcc4.1.2/bin/mips-linux-gcc
|
CC = $(TOOLCHAIN_BIN)/mips-linux-gcc
|
||||||
|
|
||||||
# Commandes d'installation et de désinstallation
|
# Commandes d'installation et de désinstallation
|
||||||
RM=rm -fv
|
RM=rm -fv
|
||||||
|
@ -25,8 +28,8 @@ DEPFLAGS=-MMD
|
||||||
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
PICFLAG=-fPIC
|
PICFLAG=-fPIC
|
||||||
LIBS=-lm -lpcap -liw ../../libowlps/libowlps.so.1.0
|
LIBS=-lm -lpcap -liw ../../libowlps/libowlps.so.1.0
|
||||||
LATHEROS=-L$(TOOLCHAIN)/mips/usr/lib/
|
LATHEROS=-L$(TOOLCHAIN_USR)/lib/ -I$(TOOLCHAIN_USR_2)/lib/
|
||||||
IATHEROS=-I$(TOOLCHAIN)/mips/usr/include/
|
IATHEROS=-I$(TOOLCHAIN_USR)/include/ -I$(TOOLCHAIN_USR_2)/include/
|
||||||
|
|
||||||
|
|
||||||
## Cibles de compilation standard ##
|
## Cibles de compilation standard ##
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
# Emplacement de la suite de cross-compilation
|
||||||
|
TOOLCHAIN = $$HOME/openwrt/atheros/8.09/staging_dir
|
||||||
|
|
||||||
|
# Répertoire d'installation
|
||||||
|
PREFIX=/usr/local
|
||||||
|
INSTALL_LIB= $(PREFIX)/lib
|
||||||
|
INSTALL_INC= $(PREFIX)/include
|
||||||
|
INSTALL_MAN= $(PREFIX)/share/man
|
||||||
|
|
||||||
|
# Compilateur
|
||||||
|
CC = $(TOOLCHAIN)/toolchain-mips_gcc4.1.2/bin/mips-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 -W -Wall -Wstrict-prototypes -O -I.
|
||||||
|
DEPFLAGS=-MMD
|
||||||
|
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
|
||||||
|
PICFLAG=-fPIC
|
||||||
|
LIBS=-liw
|
||||||
|
#STRIPFLAGS= -Wl,-s
|
||||||
|
#LDFLAGS=
|
||||||
|
LATHEROS=-L$(TOOLCHAIN)/mips/usr/lib/
|
||||||
|
IATHEROS=-I$(TOOLCHAIN)/mips/usr/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
|
||||||
|
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS) $(IATHEROS) $(LATHEROS)
|
||||||
|
%.o : %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) -c $<
|
||||||
|
%.so : %.c $(HEADER)
|
||||||
|
$(CC) $(XCFLAGS) $(IATHEROS) $(PICFLAG) -c -o $@ $<
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque dynamique
|
||||||
|
$(DYNAMIC) : $(OBJS:.o=.so)
|
||||||
|
$(CC) -shared -o $@ -Wl,-soname,$@ $(STRIPFLAGS) $(LIBS) $(IATHEROS) $(LATHEROS) -lc $^
|
||||||
|
|
||||||
|
# Compilation de la bibliothèque statique
|
||||||
|
$(STATIC) : $(OBJS:.o=.so)
|
||||||
|
$(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 $(LIB_CIBLE).so *.d
|
||||||
|
|
||||||
|
purge : clean
|
||||||
|
@$(RM) $(DYNAMIC) $(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\
|
||||||
|
tx : Compile le programme d'exemple.\n\
|
||||||
|
\n\
|
||||||
|
install : Installe la bibliothèque partagée, statique, ainsi que le programme d'exemple.\n\
|
||||||
|
install-dynamic : N'installe que la bibliothèque partagée.\n\
|
||||||
|
install-static : N'installe que la bibliothèque statique.\n\
|
||||||
|
install-tx : N'installe que le programme d'exemple.\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\
|
||||||
|
uninstall-tx : Désinstalle le programme d'exemple.\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."
|
Loading…
Reference in New Issue