49 lines
1.2 KiB
Diff
49 lines
1.2 KiB
Diff
|
--- Makefile 2018-11-04 13:26:07.744752852 -0700
|
||
|
+++ Makefile 2018-11-04 13:27:46.074222441 -0700
|
||
|
@@ -1,25 +1,26 @@
|
||
|
-CFLAGS=-O3 --std=gnu++11
|
||
|
-LFLAGS=-s -lpng
|
||
|
+CFLAGS+= -O3 --std=gnu++11
|
||
|
+LFLAGS+= -s -lpng
|
||
|
SRCD = source
|
||
|
SRC = $(wildcard $(SRCD)/*.cpp)
|
||
|
OBJD = obj
|
||
|
OBJ = $(patsubst $(SRCD)/%.cpp,$(OBJD)/%.o,$(SRC))
|
||
|
TSTD = tests
|
||
|
-INSTALL_PATH=/usr/local
|
||
|
+PREFIX?=/usr/local
|
||
|
+target=$(DESTDIR)$(PREFIX)
|
||
|
|
||
|
$(shell mkdir -p $(OBJD) >/dev/null)
|
||
|
|
||
|
bfk: $(OBJD) $(OBJ)
|
||
|
@echo Linking: $@
|
||
|
- @g++ -o bfk $(OBJ) $(LFLAGS)
|
||
|
+ @$(CXX) -o bfk $(OBJ) $(LFLAGS)
|
||
|
|
||
|
$(OBJD)/%.o: $(SRCD)/%.cpp
|
||
|
@echo Compiling: $(<F)
|
||
|
- @g++ $(CFLAGS) -c -o $@ $<
|
||
|
+ @$(CXX) $(CFLAGS) -c -o $@ $<
|
||
|
|
||
|
$(OBJD)/%.d: $(SRCD)/%.cpp
|
||
|
@set -e; rm -f $@; \
|
||
|
- g++ --std=gnu++11 -MM -MT $(OBJD)/$(*F).o $(CPPFLAGS) $< > $@.$$$$; \
|
||
|
+ $(CXX) --std=gnu++11 -MM -MT $(OBJD)/$(*F).o $(CPPFLAGS) $< > $@.$$$$; \
|
||
|
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
|
||
|
rm -f $@.$$$$
|
||
|
|
||
|
@@ -34,10 +35,10 @@
|
||
|
@$(MAKE) --silent -C $(TSTD)/ clean
|
||
|
|
||
|
install: bfk
|
||
|
- @install -m 0755 bfk $(INSTALL_PATH)/bin/
|
||
|
+ @install -m 0755 bfk $(target)/bin
|
||
|
|
||
|
remove:
|
||
|
- @rm -fv $(INSTALL_PATH)/bin/bfk
|
||
|
+ @rm -fv $(target)/bin/bfk
|
||
|
|
||
|
test: bfk
|
||
|
@sync bfk
|