Minor Makefile cleanup
[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
46 picoproj: picoproj.o
47
48 install: picoproj
49         install -d $(DESTDIR)$(bindir)
50         install -m 755 picoproj $(DESTDIR)$(bindir)
51
52 clean:
53         rm -rf *~ *.o picoproj