Modifications pour permettre utilisation du Makefile avec cygwin
This commit is contained in:
parent
bba0198a62
commit
4694cc69a0
@ -1,3 +1,4 @@
|
|||||||
|
#
|
||||||
# Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
# Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
# Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
# Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
#
|
#
|
||||||
@ -36,7 +37,7 @@
|
|||||||
#
|
#
|
||||||
# **********************************************************************
|
# **********************************************************************
|
||||||
|
|
||||||
MYSQL=mysql
|
SQL=mysql
|
||||||
BASE=dolibarr
|
BASE=dolibarr
|
||||||
OPTIONS=
|
OPTIONS=
|
||||||
|
|
||||||
@ -56,14 +57,15 @@ show:
|
|||||||
&& make show BASE=$(BASE) OPTIONS=$(OPTIONS)
|
&& make show BASE=$(BASE) OPTIONS=$(OPTIONS)
|
||||||
|
|
||||||
drop:
|
drop:
|
||||||
$(MYSQL) $(OPTIONS) $(BASE) < drop.sql
|
cd tables \
|
||||||
|
&& make drop
|
||||||
|
|
||||||
table:
|
table:
|
||||||
cd tables \
|
cd tables \
|
||||||
&& make create BASE=$(BASE) OPTIONS=$(OPTIONS)
|
&& make create BASE=$(BASE) OPTIONS=$(OPTIONS)
|
||||||
|
|
||||||
load:
|
load:
|
||||||
$(MYSQL) $(OPTIONS) $(BASE) < data/data.sql
|
$(SQL) $(OPTIONS) $(BASE) < data/data.sql
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
cd data \
|
cd data \
|
||||||
@ -78,31 +80,31 @@ fulldev: drop table load dev
|
|||||||
dropall: dropdb droppriv
|
dropall: dropdb droppriv
|
||||||
|
|
||||||
droppriv:
|
droppriv:
|
||||||
$(MYSQL) $(OPTIONS) mysql -e "delete from db where Db='$(BASE)' ; "
|
$(SQL) $(OPTIONS) $(SQL) -e "delete from db where Db='$(BASE)' ; "
|
||||||
|
|
||||||
dropdb:
|
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
|
create: drop createdb createpriv
|
||||||
|
|
||||||
createdb:
|
createdb:
|
||||||
$(MYSQL) $(OPTIONS) mysql -e "create database $(BASE) ; "
|
$(SQL) $(OPTIONS) mysql -e "create database $(BASE) ; "
|
||||||
|
|
||||||
createpriv:
|
createpriv:
|
||||||
$(MYSQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; "
|
$(SQL) $(OPTIONS) mysql -e "insert into db (Host, Db) values ('localhost', '$(BASE)') ; "
|
||||||
$(MYSQL) $(OPTIONS) mysql -e "update db set select_priv = 'Y' where db='$(BASE)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(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)' ; "
|
$(SQL) $(OPTIONS) mysql -e "update db set alter_priv = 'Y' where db='$(BASE)' ; "
|
||||||
$(MYSQL) $(OPTIONS) mysql -e "flush privileges ; "
|
$(SQL) $(OPTIONS) mysql -e "flush privileges ; "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
# Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
# Copyright (C) 2002-2003 Éric Seigne <erics@rycks.com>
|
# Copyright (C) 2002-2003 Éric Seigne <erics@rycks.com>
|
||||||
# Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
# Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# 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
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# General Makefile for postgresql database
|
|
||||||
#
|
|
||||||
# $Id$
|
# $Id$
|
||||||
# $Source$
|
# $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
|
SQL=psql
|
||||||
BASE=dolibarr
|
BASE=dolibarr
|
||||||
OPTIONS=-U postgres
|
OPTIONS=-U postgres
|
||||||
OWNER=dolibarradm
|
OWNER=dolibarradm
|
||||||
OWNERPASS=azaz
|
OWNERPASS=azaz
|
||||||
|
FIND=find
|
||||||
|
#FIND="c:/Program files/cygwin/bin/find"
|
||||||
|
|
||||||
|
|
||||||
|
TABLES=$(shell $(FIND) tables/ -name "*sql")
|
||||||
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
cd tables \
|
cat README
|
||||||
&& make show
|
|
||||||
|
|
||||||
show:
|
show:
|
||||||
cd tables \
|
cd tables \
|
||||||
&& make show
|
&& make show
|
||||||
|
|
||||||
|
drop:
|
||||||
|
cd tables \
|
||||||
|
&& make drop
|
||||||
|
|
||||||
table:
|
table:
|
||||||
cd tables \
|
cd tables \
|
||||||
&& make create
|
&& make create
|
||||||
|
load:
|
||||||
|
$(SQL) $(OPTIONS) $(BASE) < data/data.sql
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
cd data \
|
cd data \
|
||||||
&& make dev
|
&& make dev
|
||||||
|
|
||||||
fulldev: droptable table load dev
|
|
||||||
|
|
||||||
droptable:
|
|
||||||
cd tables \
|
|
||||||
&& make drop
|
|
||||||
|
|
||||||
load:
|
fulldev: drop table load dev
|
||||||
$(SQL) $(OPTIONS) $(BASE) < data/data.sql
|
|
||||||
|
|
||||||
drop: droppriv dropdb dropuser
|
drop: droppriv dropdb dropuser
|
||||||
|
|
||||||
@ -65,6 +87,8 @@ dropuser:
|
|||||||
dropdb:
|
dropdb:
|
||||||
$(SQL) $(OPTIONS) template1 -c "drop database $(BASE) ; "
|
$(SQL) $(OPTIONS) template1 -c "drop database $(BASE) ; "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
create: drop createuser createdb createpriv
|
create: drop createuser createdb createpriv
|
||||||
|
|
||||||
createuser:
|
createuser:
|
||||||
@ -77,3 +101,9 @@ createpriv:
|
|||||||
$(SQL) $(OPTIONS) template1 -c "grant all privileges on database $(BASE) to $(OWNER) ; "
|
$(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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user