Description: Handle DESTDIR variable to properly install stuff.
Author: Alessio Treglia <alessio@debian.org>
Last-Update: 2014-07-11
old
|
new
|
|
1 | 1 | PREFIX ?= /usr/local |
2 | 2 | CC = gcc |
3 | | CFLAGS ?= -O2 -g -funroll-loops -frename-registers |
| 3 | CFLAGS += -funroll-loops -frename-registers |
4 | 4 | CFLAGS += -D_LARGEFILE_SOURCE -DLARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_REENTRANT |
5 | 5 | CFLAGS += -Wall |
6 | 6 | OBJECTS = main.o |
… |
… |
M2VRequantiser : $(OBJECTS) |
14 | 14 | $(CC) $(CFLAGS) $(OBJECTS) $(LDFLAGS) $(LOADLIBES) -o M2VRequantiser |
15 | 15 | |
16 | 16 | %.o : %.c |
17 | | $(CC) $(CFLAGS) -c $< |
| 17 | $(CC) $(CPPFLAGS) $(CFLAGS) -c $< |
18 | 18 | |
19 | 19 | install: all |
20 | | $(INSTALL) -d $(PREFIX)/bin |
21 | | $(INSTALL) -m 755 M2VRequantiser $(PREFIX)/bin |
| 20 | $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin |
| 21 | $(INSTALL) -m 755 M2VRequantiser $(DESTDIR)$(PREFIX)/bin |
22 | 22 | |
23 | 23 | uninstall: |
24 | | rm -f $(PREFIX)/bin/M2VRequantiser |
| 24 | rm -f $(DESTDIR)$(PREFIX)/bin/M2VRequantiser |
25 | 25 | |
26 | 26 | clean: |
27 | 27 | rm -f M2VRequantiser *.o *~ core |