Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 234 lines (172 sloc) 5.991 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
#
# Bricolage Makefile
#
# Supports the following targets:
#
# all - default target checks requirements and builds source
# install - installs the bricolage system
# upgrade - upgrades an existing installation
# clean - delete intermediate files
# dist - prepare a distrubution from a CVS checkout
# clone - create a distribution based on an existing system
#
# See INSTALL for details.
#

#########################
# build rules #
#########################

all : required.db modules.db apache.db postgres.db config.db \
                  build_done

required.db : inst/required.pl
perl inst/required.pl

modules.db : inst/modules.pl lib/Bric/Admin.pod
perl inst/modules.pl

apache.db : inst/apache.pl required.db
perl inst/apache.pl

postgres.db : inst/postgres.pl required.db
perl inst/postgres.pl

config.db : inst/config.pl required.db apache.db postgres.db
perl inst/config.pl

build_done : required.db modules.db apache.db postgres.db config.db
@echo
@echo ===========================================================
@echo ===========================================================
@echo
@echo Bricolage Build Complete. You may now proceed to
@echo \"make install\" which must be run as root.
@echo
@echo ===========================================================
@echo ===========================================================
@echo
@touch build_done

.PHONY : all


###########################
# dist rules #
###########################

dist : check_dist distclean inst/bricolage.sql dist_dir rm_sql \
                  rm_pl rm_tst rm_use rm_CVS rm_tmp dist/INSTALL dist/Changes \
                  dist/License dist_tar

# can't load Bric since it loads Bric::Config which has dependencies
# that won't be solved till make install.
BRIC_VERSION = `perl -ne '/VERSION.*?([\d\.]+)/ and print $$1 and exit' < lib/Bric.pm`

check_dist :
perl inst/check_dist.pl $(BRIC_VERSION)

distclean : clean
-rm -rf bricolage-$(BRIC_VERSION)
-rm -f bricolage-$(BRIC_VERSION).tar.gz
-rm -rf dist

dist_dir :
-rm -rf dist
mkdir dist
ls | grep -v dist | perl -lne 'system("cp -pR $$_ dist")'

rm_sql :
find dist/lib/ -name '*.sql' -o -name '*.val' -o -name '*.con' \
        | xargs rm -rf

# We can do away with this one once the test scripts are moved out of lib.
rm_pl :
find dist/lib/ -name '*.pl' | xargs rm -rf

rm_use :
find dist/lib/ -name '*.use' | xargs rm -rf

rm_tst :
find dist/lib/ -name '*.tst' | xargs rm -rf

rm_CVS :
find dist/ -type d -name 'CVS' | xargs rm -rf
find dist/ -name '.cvsignore' | xargs rm -rf

rm_tmp :
find dist/ -name '#*#' -o -name '*~' | xargs rm -rf

dist/INSTALL : lib/Bric/Admin.pod
pod2text lib/Bric/Admin.pod > dist/INSTALL

dist/Changes : lib/Bric/Changes.pod
pod2text lib/Bric/Changes.pod > dist/Changes

dist/License : lib/Bric/License.pod
pod2text lib/Bric/License.pod > dist/License

dist_tar :
mv dist bricolage-$(BRIC_VERSION)
tar cvf bricolage-$(BRIC_VERSION).tar bricolage-$(BRIC_VERSION)
gzip --best bricolage-$(BRIC_VERSION).tar

SQL_FILES := $(shell find lib -name '*.sql' -o -name '*.val' -o -name '*.con')

inst/bricolage.sql : $(SQL_FILES)
find lib -name '*.sql' -exec grep -v '^--' '{}' ';' > inst/bricolage.sql
find lib -name '*.val' -exec grep -v '^--' '{}' ';' >> inst/bricolage.sql
find lib -name '*.con' -exec grep -v '^--' '{}' ';' >> inst/bricolage.sql

.PHONY : distclean inst/bricolage.sql dist_dir rm_sql rm_use rm_CVS \
                  dist_tar check_dist

##########################
# clone rules #
##########################


clone : distclean clone.db clone_dist_dir clone_sql clone_files \
rm_sql rm_use rm_CVS rm_tmp \
                  dist/INSTALL dist/Changes dist/License \
clone_tar

clone.db :
perl inst/clone.pl

clone_dist_dir :
-rm -rf dist
mkdir dist

clone_files :
perl inst/clone_files.pl

clone_sql :
perl inst/clone_sql.pl

clone_tar :
perl inst/clone_tar.pl

.PHONY : clone_dist_dir clone_files clone_sql clone_tar

##########################
# installation rules #
##########################

install : all cpan lib bin files db conf done

cpan : modules.db postgres.db inst/cpan.pl
perl inst/cpan.pl

lib :
-rm -f lib/Makefile
cd lib; perl Makefile.PL; $(MAKE) install

bin :
-rm -f bin/Makefile
cd bin; perl Makefile.PL; $(MAKE) install

files : config.db
perl inst/files.pl

db : inst/db.pl postgres.db
perl inst/db.pl

conf : inst/conf.pl files required.db config.db postgres.db \
                  apache.db
perl inst/conf.pl INSTALL $(BRIC_VERSION)

done : conf db files bin lib cpan
perl inst/done.pl

.PHONY : install lib bin files db conf done


##########################
# upgrade rules #
##########################

upgrade : upgrade.db required.db cpan stop lib bin db_upgrade \
upgrade_files upgrade_conf upgrade_done

upgrade.db :
perl inst/upgrade.pl

db_upgrade : upgrade.db
perl inst/db_upgrade.pl

stop :
perl inst/stop.pl

upgrade_files :
perl inst/files.pl UPGRADE

upgrade_conf :
perl inst/conf.pl UPGRADE $(BRIC_VERSION)

upgrade_done :
@echo
@echo ===========================================================
@echo ===========================================================
@echo
@echo Bricolage Upgrade Complete. You may now start your
@echo servers to start using the new version of Bricolage.
@echo
@echo ===========================================================
@echo ===========================================================
@echo

.PHONY : db_upgrade upgrade_files stop upgrade_done


##########################
# clean rules #
##########################

clean :
-rm -rf *.db
-rm -rf build_done
cd lib ; perl Makefile.PL ; $(MAKE) clean
-rm -rf lib/Makefile.old
cd bin ; perl Makefile.PL ; $(MAKE) clean
-rm -rf bin/Makefile.old

.PHONY : clean
Something went wrong with that request. Please try again.