$NetBSD: patch-Makefile,v 1.3 2022/09/11 11:58:20 martin 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 -D__linux__ # linux here means ~posix +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