Test commit
[cogito/jonas.git] / Makefile
blobcc367b6e46042851d523d58c5349bf3367e2b08b
1 # Should be changed to /usr/local
2 prefix="$(HOME)"
4 bindir=$(prefix)/bin
5 libdir=$(prefix)/lib/cogito
6 sharedir=$(prefix)/share/cogito
8 INSTALL?=install
10 export prefix bindir libdir sharedir INSTALL
13 ### --- END CONFIGURATION SECTION ---
17 SCRIPT= cg-object-id cg-add cg-admin-uncommit \
18 cg-branch-add cg-branch-ls cg-reset cg-clone cg-commit cg-diff \
19 cg-export cg-help cg-init cg-log cg-merge cg-mkpatch cg-patch \
20 cg-fetch cg-restore cg-rm cg-seek cg-status cg-tag cg-tag-ls cg-update \
21 cg cg-admin-ls cg-push cg-branch-chg cg-admin-cat cg-clean \
22 cg-admin-setuprepo cg-switch cg-mv cg-admin-rewritehist cg-tag-show
24 LIB_SCRIPT=cg-Xlib cg-Xmergefile cg-Xfetchprogress cg-Xfollowrenames
26 GEN_SCRIPT= cg-version
28 VERSION= VERSION
30 SHARE_FILES= default-exclude
32 -include config.mak
35 ### Build rules
37 .PHONY: all cogito
38 all: cogito
41 cogito: $(GEN_SCRIPT)
43 ifneq (,$(wildcard .git))
44 GIT_HEAD=.git/$(shell git-symbolic-ref HEAD)
45 GIT_HEAD_ID=$(shell cg-object-id -d)
46 endif
47 cg-version: cg-version.in $(VERSION) $(GIT_HEAD)
48 @echo Generating cg-version...
49 @rm -f $@
50 @sed -e 's/@@VERSION@@/$(shell cat $(VERSION))/' \
51 -e 's/@@GIT_HEAD_ID@@/$(GIT_HEAD_ID)/' \
52 < $< > $@
53 @chmod +x $@
55 doc:
56 $(MAKE) -C Documentation all
60 ### Testing rules
62 test: all
63 $(MAKE) -C t/ all
64 $(MAKE) -C Documentation/ test
68 ### Installation rules
70 sedlibdir=$(shell echo $(libdir) | sed 's/\//\\\//g')
71 sedsharedir=$(shell echo $(sharedir) | sed 's/\//\\\//g')
73 .PHONY: install install-cogito install-doc
74 install: install-cogito
76 install-cogito: $(SCRIPT) $(LIB_SCRIPT) $(GEN_SCRIPT)
77 $(INSTALL) -m755 -d $(DESTDIR)$(bindir)
78 $(INSTALL) $(SCRIPT) $(GEN_SCRIPT) $(DESTDIR)$(bindir)
79 $(INSTALL) -m755 -d $(DESTDIR)$(libdir)
80 $(INSTALL) $(LIB_SCRIPT) $(DESTDIR)$(libdir)
81 cd $(DESTDIR)$(bindir); \
82 for file in $(SCRIPT) $(GEN_SCRIPT); do \
83 sed -e 's/\$${COGITO_LIB}/\$${COGITO_LIB:-$(sedlibdir)\/}/g' \
84 -e 's/\$${COGITO_SHARE}/\$${COGITO_SHARE:-$(sedsharedir)\/}/g' \
85 $$file > $$file.new; \
86 cat $$file.new > $$file; rm $$file.new; \
87 done
88 cd $(DESTDIR)$(libdir); \
89 for file in $(LIB_SCRIPT); do \
90 sed -e 's/\$${COGITO_LIB}/\$${COGITO_LIB:-$(sedlibdir)\/}/g' \
91 -e 's/\$${COGITO_SHARE}/\$${COGITO_SHARE:-$(sedsharedir)\/}/g' \
92 $$file > $$file.new; \
93 cat $$file.new > $$file; rm $$file.new; \
94 done
95 $(INSTALL) -m755 -d $(DESTDIR)$(sharedir)
96 $(INSTALL) -m644 $(SHARE_FILES) $(DESTDIR)$(sharedir)
98 install-doc:
99 $(MAKE) -C Documentation install
101 uninstall:
102 cd $(DESTDIR)$(bindir) && rm -f $(SCRIPT) $(GEN_SCRIPT)
103 cd $(DESTDIR)$(libdir) && rm -f $(LIB_SCRIPT)
104 cd $(DESTDIR)$(sharedir) && rm -f $(SHARE_FILES)
108 ### Maintainer's dist rules
110 cogito.spec: cogito.spec.in $(VERSION)
111 sed -e 's/@@VERSION@@/$(shell cat $(VERSION) | cut -d"-" -f2)/g' < $< > $@
113 GIT_TARNAME=$(shell cat $(VERSION))
114 dist: cogito.spec
115 cg-export $(GIT_TARNAME).tar
116 @mkdir -p $(GIT_TARNAME)
117 @cp cogito.spec $(GIT_TARNAME)
118 tar rf $(GIT_TARNAME).tar $(GIT_TARNAME)/cogito.spec
119 @rm -rf $(GIT_TARNAME)
120 gzip -f -9 $(GIT_TARNAME).tar
122 rpm: dist
123 rpmbuild -ta $(GIT_TARNAME).tar.gz
125 deb: dist
126 tar zxf $(GIT_TARNAME).tar.gz
127 dpkg-source -b $(GIT_TARNAME)
128 cd $(GIT_TARNAME) && fakeroot debian/rules binary \
129 && cd .. && rm -rf $(GIT_TARNAME)
131 Portfile: Portfile.in $(VERSION) dist
132 sed -e 's/@@VERSION@@/$(shell cat $(VERSION) | cut -d"-" -f2)/g' < Portfile.in > Portfile
133 echo "checksums md5 " `md5sum $(GIT_TARNAME).tar.gz | cut -d ' ' -f 1` >> Portfile
137 ### Cleaning rules
139 clean:
140 rm -f $(GEN_SCRIPT)
141 rm -f cogito-*.tar.gz cogito.spec
142 $(MAKE) -C Documentation/ clean