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.

Makefile.boucle 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. ##################################################################
  2. # #
  3. # Makefile pour "clients/serveur guinness" #
  4. # #
  5. # Thomas Nemeth. #
  6. # #
  7. ##################################################################
  8. ##################################################################
  9. # #
  10. # PARTIE DES VARIABLES MODIFIABLES #
  11. # VARIABLES MODIFICATIONS ALLOWED PART #
  12. # #
  13. ##################################################################
  14. #*****************************************************************
  15. # Répertoire d'installation
  16. #
  17. # Edited for Debian GNU/Linux.
  18. DESTDIR = /tmp
  19. PREFIX = usr/local
  20. INSTALLDIR = $(DESTDIR)/$(PREFIX)
  21. BINDIR = $(INSTALLDIR)/bin
  22. # MANDIR = $(INSTALLDIR)/share/man/man1
  23. MANDIR = $(INSTALLDIR)/man/man1
  24. DATADIR = $(INSTALLDIR)/share/guinness-server
  25. ##################################################################
  26. # #
  27. # PARTIE DES VARIABLES NON MODIFIABLES ! #
  28. # NO MODIFICATION BELOW THIS LINE ! #
  29. # #
  30. ##################################################################
  31. #*****************************************************************
  32. # RÉCUPÉRATION DU NOM DU RÉPERTOIRE DE DONNÉES :
  33. #
  34. ###
  35. # GNU Make : non portable
  36. # OLDDATADIR = $(shell cat DATADIR)
  37. # OLDDATADIR = `cat DATADIR`
  38. REALDATADIR = $(PREFIX)/share/guinness-server
  39. DOCDIR = $(DATADIR)/docs
  40. #*****************************************************************
  41. # TYPE D'OS :
  42. #
  43. ###
  44. # GNU Make : non portable
  45. # MY_OSTYPE = $(shell uname -s)
  46. # MY_OSTYPE = `uname -s`
  47. #*****************************************************************
  48. # FLAGS :
  49. #
  50. CFLAGS =
  51. CPPFLAGS = -O2 -Wall
  52. EXTRA_CPPFLAGS = -D${MY_OSTYPE}
  53. LDFLAGS =
  54. #*****************************************************************
  55. # DEBUG MODE FLAGS :
  56. #
  57. DEBUG_CFLAGS = -g3
  58. # DEBUG_CPPFLAGS = -DDEBUG
  59. DEBUG_LDFLAGS = -g3
  60. #*****************************************************************
  61. # BIBLIOTHÈQUES NÉCESSAIRES ET DIFFÉRENCIATION DES OS :
  62. #
  63. # Pour OpenBSD : CPPFLAGS += -I/local/OpenBSD/src/gnu/usr.bin/binutils/include
  64. SYSLIBS = -lcrypt
  65. SERVERLIBS = -lpthread
  66. ###
  67. # GNU Make : non portable
  68. # ifeq "$(MY_OSTYPE)" "SunOS"
  69. # SYSLIBS += -lsocket -lnsl -lresolv
  70. # CPPFLAGS += -D__BUILTIN_VA_ARG_INCR
  71. # endif
  72. # ifeq "$(MY_OSTYPE)" "FreeBSD"
  73. # SERVERLIBS = -lc_r
  74. # else
  75. # SERVERLIBS = -lpthread
  76. # endif
  77. # OpenBSD : pour trouver getopt.h
  78. # CPPFLAGS += -I/local/OpenBSD/src/gnu/usr.bin/binutils/include
  79. CLIENTLIBS =
  80. #*****************************************************************
  81. # PROGRAMS - INFOS - SOURCES - OBJECTS :
  82. #
  83. PROG = guinness-server
  84. PROG1 = guinnessd
  85. PROG2 = guinness
  86. ###
  87. # GNU Make : non portable
  88. # VERSION = $(shell cat VERSION)
  89. # VERSION = `cat VERSION`
  90. CC = gcc
  91. CP = cp
  92. RM = rm
  93. INSTALL = install
  94. GZIP = gzip
  95. SED = sed
  96. SRCS1 = tools.c\
  97. xmem.c\
  98. printlog.c\
  99. lists.c\
  100. broadcast.c\
  101. drinks.c\
  102. clients.c\
  103. commands.c\
  104. guinnessd.c
  105. SRCS2 = tools.c\
  106. xmem.c\
  107. guinness.c
  108. OBJS1 = $(SRCS1:%.c=%.o)
  109. OBJS2 = $(SRCS2:%.c=%.o)
  110. DOCS = guinness-server.html\
  111. guinness.1\
  112. guinness-7bits.1\
  113. guinnessd.1\
  114. guinnessd-7bits.1\
  115. guinness-man.txt\
  116. guinness-man.man\
  117. guinnessd-man.txt\
  118. guinnessd-man.man
  119. ###
  120. # GNU Make : non portable
  121. # TODAY = $(shell date '+%d %B %Y')
  122. # TODAY = `date '+%d %B %Y'`
  123. ##################################################################
  124. # FICHIERS POUR LE PAQUETAGE CLIENT
  125. #
  126. CLIENT = guinness-client
  127. CLIENT_FILES = VERSION COPYING makedep CHANGES README BUGS TODO DATADIR guinness.* tools.* xmem.* guinness-server* config.h* defines.h
  128. ##################################################################
  129. # DÉFINITIONS GLOBALES
  130. #
  131. DEFAULT_CPPFLAGS = $(CPPFLAGS) $(EXTRA_CPPFLAGS)
  132. TOOLKIT_CPPFLAGS =
  133. ALL_CFLAGS = $(CFLAGS) $(GTK_CFLAGS) $(DEBUG_CFLAGS)
  134. ALL_CPPFLAGS = $(DEFAULT_CPPFLAGS) $(TOOLKIT_CPPFLAGS) $(DEBUG_CPPFLAGS)
  135. ALL_LIBS = $(SYSLIBS) $(XLIBS) $(DEBUG_LDFLAGS)
  136. ##################################################################
  137. # RÈGLES
  138. #
  139. # Rajouts ? Idées :
  140. # Pour une version texte:
  141. # groff -man -Tlatin1 -P-u -P-b guinness-server.1
  142. #
  143. # Pour une version html
  144. # groff -man -Thtml guinness-server.1
  145. #
  146. .PHONY: all dep datadir documentation mostlyclean clean distclean package clientpack binaries packages htmlonline online softinstall install uninstall
  147. all: datadir config.h documentation $(PROG1) $(PROG2)
  148. dep: .dependencies
  149. datadir:
  150. @if [ "$(OLDDATADIR)" != "$(REALDATADIR)" ]; then \
  151. echo "$(REALDATADIR)" > DATADIR ; \
  152. else \
  153. echo "Répertoire de configuration : $(DATADIR)" ; \
  154. fi
  155. config.h: config.h.in VERSION DATADIR
  156. $(SED) -e "s/§VERSION§/$(VERSION)/g" \
  157. -e "s,§DATADIR§,$(REALDATADIR),g" \
  158. -e "s/§OSTYPE§/$(MY_OSTYPE)/g" \
  159. -e "s/§TODAY§/${TODAY}/g" $< > $@
  160. documentation: $(DOCS)
  161. guinness-server.html: guinness-server.html.in guinnessd.1 guinness.1 VERSION
  162. $(SED) -e "s/§VERSION§/$(VERSION)/g" -e "s/§TODAY§/${TODAY}/g" $< > $@
  163. %.1: %.1.in VERSION
  164. $(SED) -e "s/§VERSION§/$(VERSION)/g" \
  165. -e "s/§TODAY§/${TODAY}/g" \
  166. -e "s,§DATADIR§,$(REALDATADIR),g" $< > $@
  167. %-7bits.1: %.1
  168. cat $< | tr "[éèêëàâäçùûüîïôöÀÉ«»]" "[eeeeaaacuuuiiooAE\"\"]" \
  169. | $(SED) -e 's/°/ degres /g' > $@
  170. %-man.txt: %.1
  171. groff -man -Tlatin1 -P-u -P-b $< > $@
  172. %-man.man: %.1
  173. groff -man -Tlatin1 $< > $@
  174. # man -l $< > $@
  175. $(PROG1): config.h $(OBJS1)
  176. $(CC) -o $(PROG1) $(OBJS1) $(LDFLAGS) $(ALL_LIBS) $(SERVERLIBS)
  177. $(PROG2): config.h $(OBJS2)
  178. $(CC) -o $(PROG2) $(OBJS2) $(LDFLAGS) $(ALL_LIBS) $(CLIENTLIBS)
  179. %.o: %.c %.h
  180. $(CC) -c $(ALL_CFLAGS) -I/usr/include $(ALL_CPPFLAGS) $<
  181. mostlyclean:
  182. -$(RM) -f *~ *.o
  183. -$(RM) -f core
  184. -$(RM) -f boissons/*~
  185. clean: mostlyclean
  186. -$(RM) -f $(PROG1)
  187. -$(RM) -f $(PROG2)
  188. distclean: clean
  189. -$(RM) -f config.h
  190. -$(RM) -f guinness-server.html
  191. -$(RM) -f *.1 guinness*-man.txt guinness*-man.man
  192. mrproper: distclean
  193. -$(RM) -f .dep*
  194. -$(RM) -f .variables
  195. package: distclean
  196. cd .. ; \
  197. $(CP) -R $(PROG) $(PROG)-$(VERSION) ; \
  198. tar -cf $(PROG)-$(VERSION).tar $(PROG)-$(VERSION)/ ; \
  199. $(GZIP) --best $(PROG)-$(VERSION).tar ; \
  200. $(RM) -rf $(PROG)-$(VERSION)/
  201. devpack: mrproper
  202. cd .. ; \
  203. tar -cf $(PROG)-dev.tar $(PROG)/ ; \
  204. $(GZIP) --best $(PROG)-dev.tar ;
  205. clientpack: clean
  206. mkdir $(CLIENT)-$(VERSION)
  207. $(CP) $(CLIENT_FILES) $(CLIENT)-$(VERSION)/
  208. sed -e 's/all:.*/all: $(PROG2)/' Makefile > $(CLIENT)-$(VERSION)/Makefile
  209. tar -cf ../$(CLIENT)-$(VERSION).tar $(CLIENT)-$(VERSION)/
  210. $(GZIP) --best ../$(CLIENT)-$(VERSION).tar
  211. -$(RM) -rf $(CLIENT)-$(VERSION)
  212. binaries: $(PROG1) $(PROG2) $(PROG1).1 $(PROG2).1
  213. $(MAKE) install DESTDIR=rootdir PREFIX=$(PREFIX)
  214. cd rootdir ; \
  215. tar -cf ../../$(PROG)-bin-$(VERSION).tar * ; \
  216. $(GZIP) --best ../../$(PROG)-bin-$(VERSION).tar
  217. -$(RM) -rf rootdir
  218. packages: binaries clientpack package
  219. htmlonline: $(PROG).html $(PROG1)-man.txt $(PROG1)-man.man $(PROG2)-man.txt $(PROG2)-man.man
  220. -$(RM) -f $(HOME)/public_html/projets/$(PROG).html
  221. -$(RM) -f $(HOME)/public_html/projets/$(PROG1)-man*
  222. -$(RM) -f $(HOME)/public_html/projets/$(PROG2)-man*
  223. $(CP) $(PROG).html $(HOME)/public_html/projets/
  224. $(CP) $(PROG1)-man* $(HOME)/public_html/projets/
  225. $(CP) $(PROG2)-man* $(HOME)/public_html/projets/
  226. online: htmlonline packages
  227. -$(RM) -f $(HOME)/public_html/projets/programmes/guinness*
  228. mv ../guinness*.tar.gz $(HOME)/public_html/projets/programmes/
  229. $(CP) README $(HOME)/public_html/projets/programmes/$(PROG).README
  230. $(CP) CHANGES $(HOME)/public_html/projets/programmes/$(PROG).CHANGES
  231. $(CP) TODO $(HOME)/public_html/projets/programmes/$(PROG).TODO
  232. $(CP) BUGS $(HOME)/public_html/projets/programmes/$(PROG).BUGS
  233. softinstall:
  234. $(INSTALL) -d --mode=0755 $(BINDIR)
  235. $(INSTALL) -s --mode=0755 ./$(PROG1) $(BINDIR)
  236. $(INSTALL) -s --mode=0755 ./$(PROG2) $(BINDIR)
  237. install: softinstall
  238. $(INSTALL) -d --mode=0755 $(MANDIR)
  239. $(INSTALL) -d --mode=0755 $(DOCDIR)
  240. $(INSTALL) -d --mode=0755 $(DATADIR)/boissons
  241. $(INSTALL) --mode=0644 boissons/* $(DATADIR)/boissons
  242. $(INSTALL) --mode=0644 ./$(PROG1).1 $(MANDIR)
  243. $(INSTALL) --mode=0644 ./$(PROG2).1 $(MANDIR)
  244. $(GZIP) --best $(MANDIR)/$(PROG1).1
  245. $(GZIP) --best $(MANDIR)/$(PROG2).1
  246. $(INSTALL) --mode=0644 README $(DOCDIR)
  247. $(INSTALL) --mode=0644 VERSION $(DOCDIR)
  248. $(INSTALL) --mode=0644 COPYING $(DOCDIR)
  249. $(INSTALL) --mode=0644 BUGS $(DOCDIR)
  250. uninstall:
  251. -$(RM) $(BINDIR)/$(PROG1)
  252. -$(RM) $(BINDIR)/$(PROG2)
  253. -$(RM) $(MANDIR)/$(PROG1).1.gz
  254. -$(RM) $(MANDIR)/$(PROG2).1.gz
  255. rmdir $(DOCDIR)
  256. rmdir $(DATADIR)/boissons
  257. rmdir $(DATADIR)
  258. .variables: fichier_qui_n_existe_pas
  259. @:> .variables
  260. @echo "OLDDATADIR = `cat DATADIR`" >> .variables
  261. @echo "MY_OSTYPE = `uname -s`" >> .variables
  262. @echo "VERSION = `cat VERSION`" >> .variables
  263. @echo "TODAY = `date '+%d %B %Y'`" >> .variables
  264. fichier_qui_n_existe_pas:
  265. include .variables
  266. .dependencies:
  267. @echo "Making dependencies..."
  268. @./makedep -s -m > .dependencies
  269. include .dependencies