File: Makefile

package info (click to toggle)
cowdancer 0.73
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 752 kB
  • ctags: 269
  • sloc: ansic: 3,822; sh: 481; makefile: 191; cpp: 6
file content (93 lines) | stat: -rw-r--r-- 3,510 bytes parent folder | download | duplicates (2)
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
SHELL=/bin/bash
BINARY=libcowdancer.so cow-shell cowbuilder qemubuilder cowdancer-ilistcreate \
	cowdancer-ilistdump
INSTALL_DIR=install -d -o root -g root -m 755
INSTALL_FILE=install -o root -g root -m 644
INSTALL_PROGRAM=install -o root -g root -m 755
DESTDIR=
PREFIX=/usr
LIBDIR=$(PREFIX)/lib
CFLAGS=-O2 -Wall -g -fno-strict-aliasing
CFLAGS_LFS=$(CFLAGS) $(shell getconf LFS_CFLAGS)
PWD=$(shell pwd)

export VERSION=$(shell sed -n '1s/.*(\(.*\)).*$$/\1/p' < debian/changelog )

all: $(BINARY)

install: $(BINARY)
	$(INSTALL_DIR) $(DESTDIR)${PREFIX}/bin
	$(INSTALL_DIR) $(DESTDIR)${LIBDIR}/cowdancer
	$(INSTALL_DIR) $(DESTDIR)${PREFIX}/share/man/man1
	$(INSTALL_DIR) $(DESTDIR)${PREFIX}/share/man/man8
	$(INSTALL_FILE)  cow-shell.1 $(DESTDIR)/usr/share/man/man1/cow-shell.1
	$(INSTALL_FILE)  cowdancer-ilistcreate.1 $(DESTDIR)/usr/share/man/man1/cowdancer-ilistcreate.1
	$(INSTALL_FILE)  cowdancer-ilistdump.1 $(DESTDIR)/usr/share/man/man1/cowdancer-ilistdump.1
	$(INSTALL_FILE)  cowbuilder.8 $(DESTDIR)/usr/share/man/man8/cowbuilder.8
	$(INSTALL_FILE)  qemubuilder.8 $(DESTDIR)/usr/share/man/man8/qemubuilder.8
	$(INSTALL_FILE)  libcowdancer.so $(DESTDIR)${LIBDIR}/cowdancer/libcowdancer.so
	$(INSTALL_PROGRAM) cow-shell $(DESTDIR)/usr/bin/cow-shell
	$(INSTALL_PROGRAM) cowbuilder $(DESTDIR)/usr/sbin/cowbuilder
	$(INSTALL_PROGRAM) qemubuilder $(DESTDIR)/usr/sbin/qemubuilder
	$(INSTALL_PROGRAM) cowdancer-ilistcreate $(DESTDIR)/usr/bin/cowdancer-ilistcreate
	$(INSTALL_PROGRAM) cowdancer-ilistdump $(DESTDIR)/usr/bin/cowdancer-ilistdump

	$(INSTALL_DIR) $(DESTDIR)/etc/bash_completion.d
	$(INSTALL_FILE) bash_completion.qemubuilder $(DESTDIR)/etc/bash_completion.d/qemubuilder
	$(INSTALL_FILE) bash_completion.cowbuilder $(DESTDIR)/etc/bash_completion.d/cowbuilder

libcowdancer.so: cowdancer.lo ilistcreate.lo
	$(CC) $(CFLAGS) -shared -o $@ $^ -ldl

cow-shell: cow-shell.o ilistcreate.o
	$(CC) $(CFLAGS) -o $@ $^

cowdancer-ilistcreate: cowdancer-ilistcreate.o ilistcreate.o
	$(CC) $(CFLAGS) -o $@ $^

cowbuilder: cowbuilder.o parameter.o forkexec.o ilistcreate.o main.o cowbuilder_util.o
	$(CC) $(CFLAGS) -o $@ $^

qemubuilder: qemubuilder.lfso parameter.lfso forkexec.lfso qemuipsanitize.lfso qemuarch.lfso file.lfso main.lfso
	$(CC) $(CFLAGS) -o $@ $^

%.lo: %.c 
	$(CC) $(CFLAGS) -fPIC $< -o $@ -c

%.lfso: %.c 
	$(CC) $(CFLAGS_LFS) $< -o $@ -c

%.o: %.c parameter.h
	$(CC) $(CFLAGS) $< -o $@ -c -D LIBDIR="\"${LIBDIR}\""

clean: 
	-rm -f *~ *.o *.lo *.lfso $(BINARY)
	-make -C initrd clean

upload-dist-all:
	scp ../cowdancer_$(VERSION).tar.gz aegis.netfort.gr.jp:public_html/software/downloads

fastcheck:
	set -e; set -o pipefail; for A in ./test_*.c; do echo $$A; \
		./tests/run_c.sh $$A 2>&1 | \
		tee tests/log/$${A/*\//}.log; done

slowcheck: cowdancer-ilistdump qemubuilder cow-shell
	# FIXME: The tests are running installed cowdancer, not the just-built
	set -e; set -o pipefail; for A in tests/[0-9][0-9][0-9]_*.sh; \
	do echo $$A; \
	PATH="$(PWD):$(PWD)/tests:/usr/bin/:/bin" \
	COWDANCER_SO=$(PWD)/libcowdancer.so \
	bash $$A  2>&1 | \
	sed -e's,/tmp/[^/]*,/tmp/XXXX,g' \
	    -e "s,^Current time:.*,Current time: TIME," \
	    -e "s,^pbuilder-time-stamp: .*,pbuilder-time-stamp: XXXX," \
	    -e "s,^Fetched .*B in .*s (.*B/s),Fetched XXXB in Xs (XXXXXB/s)," \
	| tee tests/log/$${A/*\//}.log; done

check: fastcheck slowcheck

check-syntax:
	$(CC) -c $(CFLAGS) $(CHK_SOURCES)  -o/dev/null -D LIBDIR="\"${LIBDIR}\""

.PHONY: clean check upload-dist-all check-syntax fastcheck slowcheck