42bb562b2d6a291e4755d53eefaeb7105a071220
[libam7xxx.git] / Makefile
1 CFLAGS ?= -std=c99 -pedantic -Wall -Wextra -O2
2
3 # Don't make pedantic checks errors,
4 # as vanilla libusb-1.0.8 can't live with that
5 #CFLAGS += -pedantic-errors
6
7 # GCC >= 4.6
8 #CFLAGS += -Wunused-but-set-variable
9
10 CFLAGS += -fno-common \
11   -Wall \
12   -Wextra \
13   -Wformat=2 \
14   -Winit-self \
15   -Winline \
16   -Wpacked \
17   -Wp,-D_FORTIFY_SOURCE=2 \
18   -Wpointer-arith \
19   -Wlarger-than-65500 \
20   -Wmissing-declarations \
21   -Wmissing-format-attribute \
22   -Wmissing-noreturn \
23   -Wmissing-prototypes \
24   -Wnested-externs \
25   -Wold-style-definition \
26   -Wredundant-decls \
27   -Wsign-compare \
28   -Wstrict-aliasing=2 \
29   -Wstrict-prototypes \
30   -Wswitch-enum \
31   -Wundef \
32   -Wunreachable-code \
33   -Wunsafe-loop-optimizations \
34   -Wwrite-strings
35
36 CFLAGS  += $(shell pkg-config --cflags libusb-1.0)
37 LDLIBS += $(shell pkg-config --libs libusb-1.0)
38
39 PREFIX ?= /usr/local
40 bindir := $(PREFIX)/sbin
41
42 all: picoproj
43
44 CFLAGS += -D_BSD_SOURCE # for htole32()
45 CFLAGS += -D_POSIX_C_SOURCE=2 # for getopt()
46
47 picoproj: picoproj.o
48
49 install: picoproj
50         install -d $(DESTDIR)$(bindir)
51         install -m 755 picoproj $(DESTDIR)$(bindir)
52
53 BACKUP_PREFIX=libpicoproj-$(shell date +%Y%m%d%H%M)
54 backup:
55         git archive \
56           -o $(BACKUP_PREFIX).tar.gz \
57           --prefix=$(BACKUP_PREFIX)/ \
58           HEAD
59
60 changelog:
61         git log --pretty="format:%ai  %aN  <%aE>%n%n%x09* %s%d%n" > ChangeLog
62
63 clean:
64         rm -rf *~ *.o picoproj