Skip to content
This repository was archived by the owner on Jan 6, 2018. It is now read-only.

Commit 94644f8

Browse files
committed
less lazy makefile
1 parent 728a82f commit 94644f8

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Makefile

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
.PHONY: clean default
1+
.PHONY: clean
22

3-
howto-go-with-cpp: libfoo.a
3+
TARGET=howto-go-with-cpp
4+
5+
$(TARGET): libfoo.a
46
go build .
57

68
libfoo.a: foo.o cfoo.o
7-
ar r libfoo.a foo.o cfoo.o
8-
9-
cfoo.o: cfoo.cpp
10-
g++ -O2 -o cfoo.o -c cfoo.cpp
9+
ar r $@ $^
1110

12-
foo.o: foo.cpp
13-
g++ -O2 -o foo.o -c foo.cpp
11+
%.o: %.cpp
12+
g++ -O2 -o $@ -c $^
1413

1514
clean:
16-
rm -f *.o *.so *.a howto-go-with-cpp
15+
rm -f *.o *.so *.a $(TARGET)

0 commit comments

Comments
 (0)