# 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/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 -f CP = cp # Cible TARGET=owlps-client HEADER= # 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 = $(LOWLPSCLIENTA) 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) OWLPSFLAGS = -D OWLPS_VERSION=\"$(OWLPS_VERSION)\" OWLPSFLAGS += -D DEBUG ## 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) *~ *.o *.d purge : clean @$(RM) $(TARGET) $(TARGET).static $(TARGET).semistatic ## Aide ## help : @echo "Bibliothèques nécessaires à la compilation :" @echo " libowlps1.0 (fournie)" @echo @echo "Cibles possibles :" @echo " $(TARGET) (cible par défaut) : Compile le programme \ $(TARGET)." @echo " $(TARGET).static : Compile le programme $(TARGET).static \ (version sans lien dynamique)." @echo " $(TARGET).semistatic : Compile le programme \ $(TARGET).semistatic (version sans lien dynamique vers libowlps)." @echo " install : Installe le programme $(TARGET)." @echo " uninstall : Désinstalle le programme $(TARGET)." @echo " clean : Supprime les fichiers temporaires." @echo " purge : Supprime le résultat de la compilation." @echo @echo "Note : l'installation se fait dans l'arborescence $(PREFIX). \ Modifiez la variable PREFIX du Makefile pour changer ce comportement."