File: Makefile

package info (click to toggle)
cc1541 3.3-1
  • links: PTS
  • area: main
  • in suites: bookworm, sid
  • size: 304 kB
  • sloc: ansic: 4,195; makefile: 78
file content (102 lines) | stat: -rw-r--r-- 2,670 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
94
95
96
97
98
99
100
101
102
CC1541_CFLAGS = -std=c99 -pipe -O2 -Wall -Wextra -pedantic

ALL_TARGETS = cc1541

ifneq ($(ENABLE_MAN),)
ALL_TARGETS += man
endif

ifneq ($(ENABLE_WERROR),)
CC1541_CFLAGS += -Werror
endif

override CFLAGS := $(CC1541_CFLAGS) $(CFLAGS)

prefix ?= /usr/local
bindir ?= $(prefix)/bin
mandir ?= $(prefix)/share/man

INSTALL ?= install

VERSION := $(shell grep 'define VERSION' cc1541.c | cut -d\" -f2)

CC1541_SRC := Makefile $(wildcard *.c *.h *.in *.sln *.vcxproj* LICENSE* README*)

all: $(ALL_TARGETS)

cc1541: cc1541.c

cc1541.1.txt: cc1541.1.txt.in
	sed -e "s/@@VERSION@@/$(VERSION)/g" < cc1541.1.txt.in > cc1541.1.txt

cc1541.1: cc1541.1.txt
	a2x -d manpage -f manpage cc1541.1.txt

man: cc1541.1

test_cc1541: test_cc1541.c

check: cc1541 test_cc1541
	./test_cc1541 ./cc1541

test: check

install: all
	$(INSTALL) -Dpm 0755 ./cc1541 $(DESTDIR)$(bindir)/cc1541
ifneq ($(ENABLE_MAN),)
	$(INSTALL) -Dpm 0644 ./cc1541.1 $(DESTDIR)$(mandir)/man1/cc1541.1
endif

cc1541-$(VERSION).tar: $(CC1541_SRC)
	rm -rf cc1541-$(VERSION)/ *~ README.md.T
	mkdir -p cc1541-$(VERSION)
	cp -a $(CC1541_SRC) cc1541-$(VERSION)/
	chmod 0644 cc1541-$(VERSION)/*
	tar cf cc1541-$(VERSION).tar cc1541-$(VERSION)/
	rm -rf cc1541-$(VERSION)/

cc1541-$(VERSION).tar.bz2: cc1541-$(VERSION).tar
	bzip2 -9cz < cc1541-$(VERSION).tar > cc1541-$(VERSION).tar.bz2

cc1541-$(VERSION).tar.gz: cc1541-$(VERSION).tar
	gzip -9c < cc1541-$(VERSION).tar > cc1541-$(VERSION).tar.gz

cc1541-$(VERSION).tar.xz: cc1541-$(VERSION).tar
	xz -ce < cc1541-$(VERSION).tar > cc1541-$(VERSION).tar.xz

cc1541-$(VERSION).zip: $(CC1541_SRC)
	rm -rf cc1541-$(VERSION)/ *~ README.md.T
	mkdir -p cc1541-$(VERSION)
	cp -a $(CC1541_SRC) cc1541-$(VERSION)/
	chmod 0644 cc1541-$(VERSION)/*
	zip -9r cc1541-$(VERSION).zip cc1541-$(VERSION)/
	rm -rf cc1541-$(VERSION)/

dist-bz2: cc1541-$(VERSION).tar.bz2
dist-gz:  cc1541-$(VERSION).tar.gz
dist-xz:  cc1541-$(VERSION).tar.xz
dist-zip: cc1541-$(VERSION).zip
dist-all: dist-bz2 dist-gz dist-xz dist-zip

dist: dist-gz dist-zip

dist-check: dist
	tar xf cc1541-$(VERSION).tar.gz
	$(MAKE) -C cc1541-$(VERSION)/ all check
	rm -rf cc1541-$(VERSION)/

codestyle: cc1541.c test_cc1541.c
	astyle --style=kr -n -s -z2 cc1541.c test_cc1541.c

wrap: cc1541.1.txt.in LICENSE.txt README.md
	for f in $^; do \
	  fold -s -w 70 < $$f | perl -pe 's/[\t\040]+$$//' > $$f.T; \
	  mv -f $$f.T $$f; \
	done

clean:
	rm -rf cc1541-$(VERSION)/ *~ README.md.T *.o *.orig cc1541 test_cc1541 cc1541-$(VERSION).* cc1541.1 cc1541.1.txt

.PHONY: all check clean codestyle dist dist-all dist-bz2 dist-check dist-gz dist-xz dist-zip install man test wrap

.NOTPARALLEL: cc1541-$(VERSION).tar cc1541-$(VERSION).zip