| @@ -1,44 +1,44 @@ | | | @@ -1,44 +1,44 @@ |
1 | $NetBSD: patch-Makefile,v 1.1 2019/01/16 14:43:22 martin Exp $ | | 1 | $NetBSD: patch-Makefile,v 1.2 2019/12/21 23:44:45 joerg Exp $ |
2 | | | 2 | |
3 | - Use CC instead of C to specify the C compiler and do not hardcode gcc | | 3 | - Use CC instead of C to specify the C compiler and do not hardcode gcc |
4 | - Honors user's {C,LD}FLAGS | | 4 | - Honors user's {C,LD}FLAGS |
5 | - Make the install target more flexible | | 5 | - Make the install target more flexible |
6 | | | 6 | |
7 | --- Makefile.orig 2015-09-20 14:07:55.000000000 +0000 | | 7 | --- Makefile.orig 2015-09-20 14:07:55.000000000 +0000 |
8 | +++ Makefile | | 8 | +++ Makefile |
9 | @@ -5,23 +5,29 @@ | | 9 | @@ -5,23 +5,28 @@ |
10 | # | | 10 | # |
11 | | | 11 | |
12 | | | 12 | |
13 | -C=gcc | | 13 | -C=gcc |
14 | -CFLAGS=-c -Wall | | 14 | -CFLAGS=-c -Wall |
15 | -LDFLAGS= -lm -lstdc++ | | 15 | -LDFLAGS= -lm -lstdc++ |
16 | +CC=c++ | | 16 | +CFLAGS+=-c -Wall |
17 | +CFLAGS+=-c -Wall -D__linux__ | | 17 | +LDFLAGS+= -lm |
18 | +LDFLAGS+= -lm -lstdc++ | | 18 | -SOURCES=sunwait.cpp sunriset.cpp print.cpp sunwait.h sunriset.h print.h |
19 | SOURCES=sunwait.cpp sunriset.cpp print.cpp sunwait.h sunriset.h print.h | | 19 | +SOURCES=sunwait.cpp sunriset.cpp print.cpp |
20 | OBJECTS=$(SOURCES:.cpp=.o) | | 20 | OBJECTS=$(SOURCES:.cpp=.o) |
21 | EXECUTABLE=sunwait | | 21 | EXECUTABLE=sunwait |
22 | | | 22 | |
23 | +PREFIX?= /usr | | 23 | +PREFIX?= /usr |
24 | + | | 24 | + |
25 | +INSTALL_PROGRAM?= install -m 755 | | 25 | +INSTALL_PROGRAM?= install -m 755 |
26 | +INSTALL_PROGRAM_DIR?= install -d -m 755 | | 26 | +INSTALL_PROGRAM_DIR?= install -d -m 755 |
27 | + | | 27 | + |
28 | all: $(SOURCES) $(EXECUTABLE) | | 28 | all: $(SOURCES) $(EXECUTABLE) |
29 | | | 29 | |
30 | $(EXECUTABLE): $(OBJECTS) | | 30 | $(EXECUTABLE): $(OBJECTS) |
31 | - $(C) $(OBJECTS) -o $@ $(LDFLAGS) | | 31 | - $(C) $(OBJECTS) -o $@ $(LDFLAGS) |
32 | + $(CC) $(OBJECTS) -o $@ $(LDFLAGS) | | 32 | + $(CXX) $(OBJECTS) -o $@ $(LDFLAGS) |
33 | | | 33 | |
34 | .cpp.o: | | 34 | .cpp.o: |
35 | - $(C) $(CFLAGS) $< -o $@ | | 35 | - $(C) $(CFLAGS) $< -o $@ |
36 | + $(CC) $(CFLAGS) $< -o $@ | | 36 | + $(CXX) -c $(CFLAGS) $< -o $@ |
37 | | | 37 | |
38 | clean: | | 38 | clean: |
39 | rm -f *.o sunwait | | 39 | rm -f *.o sunwait |
40 | | | 40 | |
41 | install: | | 41 | install: |
42 | - install -D -m 755 sunwait $(DESTDIR)/usr/bin/sunwait | | 42 | - install -D -m 755 sunwait $(DESTDIR)/usr/bin/sunwait |
43 | + ${INSTALL_PROGRAM_DIR} $(DESTDIR)$(PREFIX)/bin | | 43 | + ${INSTALL_PROGRAM_DIR} $(DESTDIR)$(PREFIX)/bin |
44 | + ${INSTALL_PROGRAM} sunwait $(DESTDIR)$(PREFIX)/bin/sunwait | | 44 | + ${INSTALL_PROGRAM} sunwait $(DESTDIR)$(PREFIX)/bin/sunwait |