44 lines
1 KiB
Text
44 lines
1 KiB
Text
$NetBSD: patch-Makefile,v 1.2 2019/12/21 23:44:45 joerg Exp $
|
|
|
|
- Use CC instead of C to specify the C compiler and do not hardcode gcc
|
|
- Honors user's {C,LD}FLAGS
|
|
- Make the install target more flexible
|
|
|
|
--- Makefile.orig 2015-09-20 14:07:55.000000000 +0000
|
|
+++ Makefile
|
|
@@ -5,23 +5,28 @@
|
|
#
|
|
|
|
|
|
-C=gcc
|
|
-CFLAGS=-c -Wall
|
|
-LDFLAGS= -lm -lstdc++
|
|
+CFLAGS+=-c -Wall
|
|
+LDFLAGS+= -lm
|
|
-SOURCES=sunwait.cpp sunriset.cpp print.cpp sunwait.h sunriset.h print.h
|
|
+SOURCES=sunwait.cpp sunriset.cpp print.cpp
|
|
OBJECTS=$(SOURCES:.cpp=.o)
|
|
EXECUTABLE=sunwait
|
|
|
|
+PREFIX?= /usr
|
|
+
|
|
+INSTALL_PROGRAM?= install -m 755
|
|
+INSTALL_PROGRAM_DIR?= install -d -m 755
|
|
+
|
|
all: $(SOURCES) $(EXECUTABLE)
|
|
|
|
$(EXECUTABLE): $(OBJECTS)
|
|
- $(C) $(OBJECTS) -o $@ $(LDFLAGS)
|
|
+ $(CXX) $(OBJECTS) -o $@ $(LDFLAGS)
|
|
|
|
.cpp.o:
|
|
- $(C) $(CFLAGS) $< -o $@
|
|
+ $(CXX) -c $(CFLAGS) $< -o $@
|
|
|
|
clean:
|
|
rm -f *.o sunwait
|
|
|
|
install:
|
|
- install -D -m 755 sunwait $(DESTDIR)/usr/bin/sunwait
|
|
+ ${INSTALL_PROGRAM_DIR} $(DESTDIR)$(PREFIX)/bin
|
|
+ ${INSTALL_PROGRAM} sunwait $(DESTDIR)$(PREFIX)/bin/sunwait
|