From 4694cc69a08cc3bd07dadbd56d051d35bad3db2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Feb 2005 13:21:48 +0000 Subject: [PATCH] Modifications pour permettre utilisation du Makefile avec cygwin --- mysql/Makefile | 38 +++++++++++++++++++----------------- pgsql/Makefile | 52 +++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/mysql/Makefile b/mysql/Makefile index 9f58a2af9ee..39c2863db65 100644 --- a/mysql/Makefile +++ b/mysql/Makefile @@ -1,3 +1,4 @@ +# # Copyright (C) 2001-2003 Rodolphe Quiedeville # Copyright (C) 2005 Laurent Destailleur # @@ -36,7 +37,7 @@ # # ********************************************************************** -MYSQL=mysql +SQL=mysql BASE=dolibarr OPTIONS= @@ -56,14 +57,15 @@ show: && make show BASE=$(BASE) OPTIONS=$(OPTIONS) drop: - $(MYSQL) $(OPTIONS) $(BASE) < drop.sql + cd tables \ + && make drop table: cd tables \ && make create BASE=$(BASE) OPTIONS=$(OPTIONS) load: - $(MYSQL) $(OPTIONS) $(BASE) < data/data.sql + $(SQL) $(OPTIONS) $(BASE) < data/data.sql dev: cd data \ @@ -78,31 +80,31 @@ fulldev: drop table load dev dropall: dropdb droppriv droppriv: - $(MYSQL) $(OPTIONS) mysql -e "delete from db where Db='$(BASE)' ; " + $(SQL) $(OPTIONS) $(SQL) -e "delete from db where Db='$(BASE)' ; " dropdb: - $(MYSQL) $(OPTIONS) mysql -f -e "drop database if exists $(BASE) ; " + $(SQL) $(OPTIONS) $(SQL) -f -e "drop database if exists $(BASE) ; " create: drop createdb createpriv createdb: - $(MYSQL) $(OPTIONS) mysql -e "create database $(BASE) ; " + $(SQL) $(OPTIONS) mysql -e "create database $(BASE) ; " createpriv: - $(MYSQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set select_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set insert_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set update_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set delete_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set create_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set drop_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set grant_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set references_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set index_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "update db set alter_priv = 'Y' where db='$(BASE)' ; " - $(MYSQL) $(OPTIONS) mysql -e "flush privileges ; " + $(SQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; " + $(SQL) $(OPTIONS) mysql -e "update db set select_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set insert_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set update_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set delete_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set create_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set drop_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set grant_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set references_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set index_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "update db set alter_priv = 'Y' where db='$(BASE)' ; " + $(SQL) $(OPTIONS) mysql -e "flush privileges ; " diff --git a/pgsql/Makefile b/pgsql/Makefile index 164d2b89711..983d6d871af 100644 --- a/pgsql/Makefile +++ b/pgsql/Makefile @@ -1,7 +1,7 @@ # # Copyright (C) 2001-2002 Rodolphe Quiedeville # Copyright (C) 2002-2003 Éric Seigne -# Copyright (C) 2004 Benoit Mortier +# Copyright (C) 2004 Benoit Mortier # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,42 +17,64 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -# General Makefile for postgresql database -# # $Id$ # $Source$ # +# ********************************************************************** +# Ce makefile permet d'initialiser la base de donnée de dolibarr en manuel. +# Il n'est utile que si vous n'utilisez pas l'installateur automatique +# accessible à http://localhost/dolibarr/install/ +# +# Pour une installation manuelle, créer la base dolibarr puis faire: +# make table +# make load +# +# Ou bien, toujours après avoir créer la base dolibarr: +# make mysql.sql +# mysql dolibarr < mysql.sql +# +# Le script mysql.sql cotient tous le ordres sql pour créer la base +# Tables + Index et Clés + Données +# +# ********************************************************************** SQL=psql BASE=dolibarr OPTIONS=-U postgres OWNER=dolibarradm OWNERPASS=azaz +FIND=find +#FIND="c:/Program files/cygwin/bin/find" + + +TABLES=$(shell $(FIND) tables/ -name "*sql") + all: - cd tables \ - && make show + cat README show: cd tables \ && make show +drop: + cd tables \ + && make drop + table: cd tables \ && make create +load: + $(SQL) $(OPTIONS) $(BASE) < data/data.sql dev: cd data \ && make dev -fulldev: droptable table load dev -droptable: - cd tables \ - && make drop -load: - $(SQL) $(OPTIONS) $(BASE) < data/data.sql +fulldev: drop table load dev + drop: droppriv dropdb dropuser @@ -65,6 +87,8 @@ dropuser: dropdb: $(SQL) $(OPTIONS) template1 -c "drop database $(BASE) ; " + + create: drop createuser createdb createpriv createuser: @@ -77,3 +101,9 @@ createpriv: $(SQL) $(OPTIONS) template1 -c "grant all privileges on database $(BASE) to $(OWNER) ; " +pgsql.sql: $(TABLES) data/data.sql Makefile + echo "-- Fichier généré par make pgsql.sql" > pgsql.sql + echo "-- Contient les ordres de creation des tables + les clés + les données" >> pgsql.sql + echo "-- ;" >> pgsql.sql + $(FIND) tables/ -name "*sql" | xargs cat | grep -v "^--" | cut -d "-" -f 1 >> pgsql.sql + cat data/data.sql | grep -v ^-- >> pgsql.sql