[Client] Add Makefile_atheros

And tweak Makefile.
This commit is contained in:
Matteo Cypriani 2010-10-22 10:13:39 +02:00
parent 6cbbcc957b
commit c17af1cf95
2 changed files with 118 additions and 9 deletions

View File

@ -17,20 +17,21 @@ TARGET=owlps-client
HEADER=
# Flags
CFLAGS=-O2 -W -Wall -Wstrict-prototypes -O -I.
DEPFLAGS=-MMD
XCFLAGS=$(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG=-fPIC
LIBS=../../libowlps/libowlps.so.1.0 ../libowlps-client/libowlps-client.a
STATIC_LIBS=-liw -lm
CFLAGS = -O2 -W -Wall -Wstrict-prototypes -O -I.
DEPFLAGS = -MMD
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG = -fPIC
LIBS = -L../../libowlps -lowlps -L../libowlps-client -lowlps-client
STATIC_LIBS = -liw -lm
## Cibles de compilation standard ##
.PHONY : all install uninstall clean purge help
.PHONY : all dynamic static install uninstall clean purge help
all : $(TARGET)
dynamic : $(TARGET)
static : $(TARGET).static
all : dynamic static
% : %.o
$(CC) $(LDFLAGS) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LIBS)
@ -75,9 +76,12 @@ help :
\n\
Cibles possibles :\n\
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
$(TARGET).static : Compile le programme $(TARGET).static \
(version sans lien dynamique).\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."
Note : l'installation se fait dans l'arborescence $(PREFIX). \
Modifiez la variable PREFIX du Makefile pour changer ce comportement."

View File

@ -0,0 +1,105 @@
# Emplacement de la suite de cross-compilation
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
INSTALL_DIR= $(PREFIX)/bin
INSTALL_LIB= $(PREFIX)/lib
INSTALL_INC= $(PREFIX)/include
INSTALL_MAN= $(PREFIX)/share/man
# Compilateur
CC = $(TOOLCHAIN_BIN)/mips-linux-gcc
# Commandes d'installation et de désinstallation
RM=rm -fv
CP=cp -v
# Cible
TARGET=owlps-client
HEADER=
# Flags
CFLAGS = -O2 -W -Wall -Wstrict-prototypes -I.
DEPFLAGS = -MMD
XCFLAGS = $(CFLAGS) $(DEPFLAGS) $(WARN) $(HEADERS)
PICFLAG = -fPIC
LOWLPS = -L../../libowlps -lowlps
LOWLPSA = ../../libowlps/libowlps.a
LOWLPSCLIENTA = ../libowlps-client/libowlps-client.a
LIBS = $(LOWLPSCLIENTA) -liw -lm
DYNAMIC_LIBS = $(LOWLPS) $(LIBS)
SEMISTATIC_LIBS = $(LOWLPSA) $(LIBS)
STATIC_LIBS = $(LOWLPSA) $(LIBS)
LATHEROS = -L$(TOOLCHAIN_USR)/lib -L$(TOOLCHAIN_USR_2)/lib
IATHEROS = -I$(TOOLCHAIN_USR)/include -I$(TOOLCHAIN_USR_2)/include
LDFLAGS = $(IATHEROS) $(LATHEROS)
## 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 $@ $^ $(LDFLAGS) $(DYNAMIC_LIBS)
%.semistatic: %.o
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(SEMISTATIC_LIBS)
%.static: %.o
$(CC) $(STRIPFLAGS) $(XCFLAGS) -o $@ $^ $(LDFLAGS) $(STATIC_LIBS) \
-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\
libowlps1.0 (fournie)\n\
\n\
Cibles possibles :\n\
$(TARGET) (cible par défaut) : Compile le programme $(TARGET).\n\
$(TARGET).static : Compile le programme $(TARGET).static \
(version sans lien dynamique).\n\
$(TARGET).semistatic : Compile le programme $(TARGET).semistatic \
(version sans lien dynamique vers libowlps).\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."