Comment servir des pintes de Guinness "over Internet" ;) Reprise/Fork d'un très ancien code d'un pilier de f.m.b.l : http://tnemeth.free.fr/projets/guinness-server.html
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

341 lines
9.9 KiB

##################################################################
# #
# Makefile pour "clients/serveur guinness" #
# #
# Thomas Nemeth. #
# #
##################################################################
##################################################################
# #
# PARTIE DES VARIABLES MODIFIABLES #
# VARIABLES MODIFICATIONS ALLOWED PART #
# #
##################################################################
#*****************************************************************
# Répertoire d'installation
#
# Edited for Debian GNU/Linux.
DESTDIR = /tmp
PREFIX = usr/local
INSTALLDIR = $(DESTDIR)/$(PREFIX)
BINDIR = $(INSTALLDIR)/bin
# MANDIR = $(INSTALLDIR)/share/man/man1
MANDIR = $(INSTALLDIR)/man/man1
DATADIR = $(INSTALLDIR)/share/guinness-server
##################################################################
# #
# PARTIE DES VARIABLES NON MODIFIABLES ! #
# NO MODIFICATION BELOW THIS LINE ! #
# #
##################################################################
#*****************************************************************
# RÉCUPÉRATION DU NOM DU RÉPERTOIRE DE DONNÉES :
#
###
# GNU Make : non portable
# OLDDATADIR = $(shell cat DATADIR)
# OLDDATADIR = `cat DATADIR`
REALDATADIR = $(PREFIX)/share/guinness-server
DOCDIR = $(DATADIR)/docs
#*****************************************************************
# TYPE D'OS :
#
###
# GNU Make : non portable
# MY_OSTYPE = $(shell uname -s)
# MY_OSTYPE = `uname -s`
#*****************************************************************
# FLAGS :
#
CFLAGS =
CPPFLAGS = -O2 -Wall
EXTRA_CPPFLAGS = -D${MY_OSTYPE}
LDFLAGS =
#*****************************************************************
# DEBUG MODE FLAGS :
#
DEBUG_CFLAGS = -g3
# DEBUG_CPPFLAGS = -DDEBUG
DEBUG_LDFLAGS = -g3
#*****************************************************************
# BIBLIOTHÈQUES NÉCESSAIRES ET DIFFÉRENCIATION DES OS :
#
# Pour OpenBSD : CPPFLAGS += -I/local/OpenBSD/src/gnu/usr.bin/binutils/include
SYSLIBS = -lcrypt
SERVERLIBS = -lpthread
###
# GNU Make : non portable
# ifeq "$(MY_OSTYPE)" "SunOS"
# SYSLIBS += -lsocket -lnsl -lresolv
# CPPFLAGS += -D__BUILTIN_VA_ARG_INCR
# endif
# ifeq "$(MY_OSTYPE)" "FreeBSD"
# SERVERLIBS = -lc_r
# else
# SERVERLIBS = -lpthread
# endif
# OpenBSD : pour trouver getopt.h
# CPPFLAGS += -I/local/OpenBSD/src/gnu/usr.bin/binutils/include
CLIENTLIBS =
#*****************************************************************
# PROGRAMS - INFOS - SOURCES - OBJECTS :
#
PROG = guinness-server
PROG1 = guinnessd
PROG2 = guinness
###
# GNU Make : non portable
# VERSION = $(shell cat VERSION)
# VERSION = `cat VERSION`
CC = gcc
CP = cp
RM = rm
INSTALL = install
GZIP = gzip
SED = sed
SRCS1 = tools.c\
xmem.c\
printlog.c\
lists.c\
broadcast.c\
drinks.c\
clients.c\
commands.c\
guinnessd.c
SRCS2 = tools.c\
xmem.c\
guinness.c
OBJS1 = $(SRCS1:%.c=%.o)
OBJS2 = $(SRCS2:%.c=%.o)
DOCS = guinness-server.html\
guinness.1\
guinness-7bits.1\
guinnessd.1\
guinnessd-7bits.1\
guinness-man.txt\
guinness-man.man\
guinnessd-man.txt\
guinnessd-man.man
###
# GNU Make : non portable
# TODAY = $(shell date '+%d %B %Y')
# TODAY = `date '+%d %B %Y'`
##################################################################
# FICHIERS POUR LE PAQUETAGE CLIENT
#
CLIENT = guinness-client
CLIENT_FILES = VERSION COPYING makedep CHANGES README BUGS TODO DATADIR guinness.* tools.* xmem.* guinness-server* config.h* defines.h
##################################################################
# DÉFINITIONS GLOBALES
#
DEFAULT_CPPFLAGS = $(CPPFLAGS) $(EXTRA_CPPFLAGS)
TOOLKIT_CPPFLAGS =
ALL_CFLAGS = $(CFLAGS) $(GTK_CFLAGS) $(DEBUG_CFLAGS)
ALL_CPPFLAGS = $(DEFAULT_CPPFLAGS) $(TOOLKIT_CPPFLAGS) $(DEBUG_CPPFLAGS)
ALL_LIBS = $(SYSLIBS) $(XLIBS) $(DEBUG_LDFLAGS)
##################################################################
# RÈGLES
#
# Rajouts ? Idées :
# Pour une version texte:
# groff -man -Tlatin1 -P-u -P-b guinness-server.1
#
# Pour une version html
# groff -man -Thtml guinness-server.1
#
.PHONY: all dep datadir documentation mostlyclean clean distclean package clientpack binaries packages htmlonline online softinstall install uninstall
all: datadir config.h documentation $(PROG1) $(PROG2)
dep: .dependencies
datadir:
@if [ "$(OLDDATADIR)" != "$(REALDATADIR)" ]; then \
echo "$(REALDATADIR)" > DATADIR ; \
else \
echo "Répertoire de configuration : $(DATADIR)" ; \
fi
config.h: config.h.in VERSION DATADIR
$(SED) -e "s/§VERSION§/$(VERSION)/g" \
-e "s,§DATADIR§,$(REALDATADIR),g" \
-e "s/§OSTYPE§/$(MY_OSTYPE)/g" \
-e "s/§TODAY§/${TODAY}/g" $< > $@
documentation: $(DOCS)
guinness-server.html: guinness-server.html.in guinnessd.1 guinness.1 VERSION
$(SED) -e "s/§VERSION§/$(VERSION)/g" -e "s/§TODAY§/${TODAY}/g" $< > $@
%.1: %.1.in VERSION
$(SED) -e "s/§VERSION§/$(VERSION)/g" \
-e "s/§TODAY§/${TODAY}/g" \
-e "s,§DATADIR§,$(REALDATADIR),g" $< > $@
%-7bits.1: %.1
cat $< | tr "[éèêëàâäçùûüîïôöÀÉ«»]" "[eeeeaaacuuuiiooAE\"\"]" \
| $(SED) -e 's/°/ degres /g' > $@
%-man.txt: %.1
groff -man -Tlatin1 -P-u -P-b $< > $@
%-man.man: %.1
groff -man -Tlatin1 $< > $@
# man -l $< > $@
$(PROG1): config.h $(OBJS1)
$(CC) -o $(PROG1) $(OBJS1) $(LDFLAGS) $(ALL_LIBS) $(SERVERLIBS)
$(PROG2): config.h $(OBJS2)
$(CC) -o $(PROG2) $(OBJS2) $(LDFLAGS) $(ALL_LIBS) $(CLIENTLIBS)
%.o: %.c %.h
$(CC) -c $(ALL_CFLAGS) -I/usr/include $(ALL_CPPFLAGS) $<
mostlyclean:
-$(RM) -f *~ *.o
-$(RM) -f core
-$(RM) -f boissons/*~
clean: mostlyclean
-$(RM) -f $(PROG1)
-$(RM) -f $(PROG2)
distclean: clean
-$(RM) -f config.h
-$(RM) -f guinness-server.html
-$(RM) -f *.1 guinness*-man.txt guinness*-man.man
mrproper: distclean
-$(RM) -f .dep*
-$(RM) -f .variables
package: distclean
cd .. ; \
$(CP) -R $(PROG) $(PROG)-$(VERSION) ; \
tar -cf $(PROG)-$(VERSION).tar $(PROG)-$(VERSION)/ ; \
$(GZIP) --best $(PROG)-$(VERSION).tar ; \
$(RM) -rf $(PROG)-$(VERSION)/
devpack: mrproper
cd .. ; \
tar -cf $(PROG)-dev.tar $(PROG)/ ; \
$(GZIP) --best $(PROG)-dev.tar ;
clientpack: clean
mkdir $(CLIENT)-$(VERSION)
$(CP) $(CLIENT_FILES) $(CLIENT)-$(VERSION)/
sed -e 's/all:.*/all: $(PROG2)/' Makefile > $(CLIENT)-$(VERSION)/Makefile
tar -cf ../$(CLIENT)-$(VERSION).tar $(CLIENT)-$(VERSION)/
$(GZIP) --best ../$(CLIENT)-$(VERSION).tar
-$(RM) -rf $(CLIENT)-$(VERSION)
binaries: $(PROG1) $(PROG2) $(PROG1).1 $(PROG2).1
$(MAKE) install DESTDIR=rootdir PREFIX=$(PREFIX)
cd rootdir ; \
tar -cf ../../$(PROG)-bin-$(VERSION).tar * ; \
$(GZIP) --best ../../$(PROG)-bin-$(VERSION).tar
-$(RM) -rf rootdir
packages: binaries clientpack package
htmlonline: $(PROG).html $(PROG1)-man.txt $(PROG1)-man.man $(PROG2)-man.txt $(PROG2)-man.man
-$(RM) -f $(HOME)/public_html/projets/$(PROG).html
-$(RM) -f $(HOME)/public_html/projets/$(PROG1)-man*
-$(RM) -f $(HOME)/public_html/projets/$(PROG2)-man*
$(CP) $(PROG).html $(HOME)/public_html/projets/
$(CP) $(PROG1)-man* $(HOME)/public_html/projets/
$(CP) $(PROG2)-man* $(HOME)/public_html/projets/
online: htmlonline packages
-$(RM) -f $(HOME)/public_html/projets/programmes/guinness*
mv ../guinness*.tar.gz $(HOME)/public_html/projets/programmes/
$(CP) README $(HOME)/public_html/projets/programmes/$(PROG).README
$(CP) CHANGES $(HOME)/public_html/projets/programmes/$(PROG).CHANGES
$(CP) TODO $(HOME)/public_html/projets/programmes/$(PROG).TODO
$(CP) BUGS $(HOME)/public_html/projets/programmes/$(PROG).BUGS
softinstall:
$(INSTALL) -d --mode=0755 $(BINDIR)
$(INSTALL) -s --mode=0755 ./$(PROG1) $(BINDIR)
$(INSTALL) -s --mode=0755 ./$(PROG2) $(BINDIR)
install: softinstall
$(INSTALL) -d --mode=0755 $(MANDIR)
$(INSTALL) -d --mode=0755 $(DOCDIR)
$(INSTALL) -d --mode=0755 $(DATADIR)/boissons
$(INSTALL) --mode=0644 boissons/* $(DATADIR)/boissons
$(INSTALL) --mode=0644 ./$(PROG1).1 $(MANDIR)
$(INSTALL) --mode=0644 ./$(PROG2).1 $(MANDIR)
$(GZIP) --best $(MANDIR)/$(PROG1).1
$(GZIP) --best $(MANDIR)/$(PROG2).1
$(INSTALL) --mode=0644 README $(DOCDIR)
$(INSTALL) --mode=0644 VERSION $(DOCDIR)
$(INSTALL) --mode=0644 COPYING $(DOCDIR)
$(INSTALL) --mode=0644 BUGS $(DOCDIR)
uninstall:
-$(RM) $(BINDIR)/$(PROG1)
-$(RM) $(BINDIR)/$(PROG2)
-$(RM) $(MANDIR)/$(PROG1).1.gz
-$(RM) $(MANDIR)/$(PROG2).1.gz
rmdir $(DOCDIR)
rmdir $(DATADIR)/boissons
rmdir $(DATADIR)
.variables: fichier_qui_n_existe_pas
@:> .variables
@echo "OLDDATADIR = `cat DATADIR`" >> .variables
@echo "MY_OSTYPE = `uname -s`" >> .variables
@echo "VERSION = `cat VERSION`" >> .variables
@echo "TODAY = `date '+%d %B %Y'`" >> .variables
fichier_qui_n_existe_pas:
include .variables
.dependencies:
@echo "Making dependencies..."
@./makedep -s -m > .dependencies
include .dependencies