Home | History | Annotate | Download | only in lcov
      1 #
      2 # Makefile for LCOV
      3 #
      4 # Make targets:
      5 #   - install:   install LCOV tools and man pages on the system
      6 #   - uninstall: remove tools and man pages from the system
      7 #   - dist:      create files required for distribution, i.e. the lcov.tar.gz
      8 #                and the lcov.rpm file. Just make sure to adjust the VERSION
      9 #                and RELEASE variables below - both version and date strings
     10 #                will be updated in all necessary files.
     11 #   - clean:     remove all generated files
     12 #
     13 
     14 VERSION := 1.10
     15 RELEASE := 1
     16 
     17 CFG_DIR := $(PREFIX)/etc
     18 BIN_DIR := $(PREFIX)/usr/bin
     19 MAN_DIR := $(PREFIX)/usr/share/man
     20 TMP_DIR := /tmp/lcov-tmp.$(shell echo $$$$)
     21 FILES   := $(wildcard bin/*) $(wildcard man/*) README CHANGES Makefile \
     22 	   $(wildcard rpm/*) lcovrc
     23 
     24 .PHONY: all info clean install uninstall rpms
     25 
     26 all: info
     27 
     28 info:
     29 	@echo "Available make targets:"
     30 	@echo "  install   : install binaries and man pages in PREFIX (default /)"
     31 	@echo "  uninstall : delete binaries and man pages from PREFIX (default /)"
     32 	@echo "  dist      : create packages (RPM, tarball) ready for distribution"
     33 
     34 clean:
     35 	rm -f lcov-*.tar.gz
     36 	rm -f lcov-*.rpm
     37 	make -C example clean
     38 
     39 install:
     40 	bin/install.sh bin/lcov $(BIN_DIR)/lcov -m 755
     41 	bin/install.sh bin/genhtml $(BIN_DIR)/genhtml -m 755
     42 	bin/install.sh bin/geninfo $(BIN_DIR)/geninfo -m 755
     43 	bin/install.sh bin/genpng $(BIN_DIR)/genpng -m 755
     44 	bin/install.sh bin/gendesc $(BIN_DIR)/gendesc -m 755
     45 	bin/install.sh man/lcov.1 $(MAN_DIR)/man1/lcov.1 -m 644
     46 	bin/install.sh man/genhtml.1 $(MAN_DIR)/man1/genhtml.1 -m 644
     47 	bin/install.sh man/geninfo.1 $(MAN_DIR)/man1/geninfo.1 -m 644
     48 	bin/install.sh man/genpng.1 $(MAN_DIR)/man1/genpng.1 -m 644
     49 	bin/install.sh man/gendesc.1 $(MAN_DIR)/man1/gendesc.1 -m 644
     50 	bin/install.sh man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5 -m 644
     51 	bin/install.sh lcovrc $(CFG_DIR)/lcovrc -m 644
     52 
     53 uninstall:
     54 	bin/install.sh --uninstall bin/lcov $(BIN_DIR)/lcov
     55 	bin/install.sh --uninstall bin/genhtml $(BIN_DIR)/genhtml
     56 	bin/install.sh --uninstall bin/geninfo $(BIN_DIR)/geninfo
     57 	bin/install.sh --uninstall bin/genpng $(BIN_DIR)/genpng
     58 	bin/install.sh --uninstall bin/gendesc $(BIN_DIR)/gendesc
     59 	bin/install.sh --uninstall man/lcov.1 $(MAN_DIR)/man1/lcov.1
     60 	bin/install.sh --uninstall man/genhtml.1 $(MAN_DIR)/man1/genhtml.1
     61 	bin/install.sh --uninstall man/geninfo.1 $(MAN_DIR)/man1/geninfo.1
     62 	bin/install.sh --uninstall man/genpng.1 $(MAN_DIR)/man1/genpng.1
     63 	bin/install.sh --uninstall man/gendesc.1 $(MAN_DIR)/man1/gendesc.1
     64 	bin/install.sh --uninstall man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5
     65 	bin/install.sh --uninstall lcovrc $(CFG_DIR)/lcovrc
     66 
     67 dist: lcov-$(VERSION).tar.gz lcov-$(VERSION)-$(RELEASE).noarch.rpm \
     68       lcov-$(VERSION)-$(RELEASE).src.rpm
     69 
     70 lcov-$(VERSION).tar.gz: $(FILES)
     71 	mkdir $(TMP_DIR)
     72 	mkdir $(TMP_DIR)/lcov-$(VERSION)
     73 	cp -r * $(TMP_DIR)/lcov-$(VERSION)
     74 	find $(TMP_DIR)/lcov-$(VERSION) -name CVS -type d | xargs rm -rf
     75 	make -C $(TMP_DIR)/lcov-$(VERSION) clean
     76 	bin/updateversion.pl $(TMP_DIR)/lcov-$(VERSION) $(VERSION) $(RELEASE)
     77 	cd $(TMP_DIR) ; \
     78 	tar cfz $(TMP_DIR)/lcov-$(VERSION).tar.gz lcov-$(VERSION)
     79 	mv $(TMP_DIR)/lcov-$(VERSION).tar.gz .
     80 	rm -rf $(TMP_DIR)
     81 
     82 lcov-$(VERSION)-$(RELEASE).noarch.rpm: rpms
     83 lcov-$(VERSION)-$(RELEASE).src.rpm: rpms
     84 
     85 rpms: lcov-$(VERSION).tar.gz
     86 	mkdir $(TMP_DIR)
     87 	mkdir $(TMP_DIR)/BUILD
     88 	mkdir $(TMP_DIR)/RPMS
     89 	mkdir $(TMP_DIR)/SOURCES
     90 	mkdir $(TMP_DIR)/SRPMS
     91 	cp lcov-$(VERSION).tar.gz $(TMP_DIR)/SOURCES
     92 	cd $(TMP_DIR)/BUILD ; \
     93 	tar xfz $(TMP_DIR)/SOURCES/lcov-$(VERSION).tar.gz \
     94 		lcov-$(VERSION)/rpm/lcov.spec
     95 	rpmbuild --define '_topdir $(TMP_DIR)' \
     96 		 -ba $(TMP_DIR)/BUILD/lcov-$(VERSION)/rpm/lcov.spec
     97 	mv $(TMP_DIR)/RPMS/noarch/lcov-$(VERSION)-$(RELEASE).noarch.rpm .
     98 	mv $(TMP_DIR)/SRPMS/lcov-$(VERSION)-$(RELEASE).src.rpm .
     99 	rm -rf $(TMP_DIR)
    100