-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
39 lines (27 loc) · 1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
PROG=weather
OBJDIR=.obj
CC=g++
CFLAGS = -Wall --std=c++14 -I../include `pkg-config libcurl --libs`
LDFLAGS = `pkg-config libcurl --libs` -L../lib -lMetar
$(shell mkdir -p $(OBJDIR))
OBJS = $(OBJDIR)/main.o $(OBJDIR)/Phenom2String.o $(OBJDIR)/Fetch.o
$(PROG) : $(OBJS)
$(CC) $(OBJS) $(LDFLAGS) -o $(PROG)
-include $(OBJS:.o=.d)
Fetch.cpp: Fetch.h
wget https://github.com/jachappell/Curlpp/raw/master/Fetch.cpp
Curl.h:
wget https://github.com/jachappell/Curlpp/raw/master/Curl.h
Fetch.h: Curl.h
wget https://github.com/jachappell/Curlpp/raw/master/Fetch.h
main.cpp: Fetch.h Curl.h
$(OBJDIR)/%.o: %.cpp
$(CC) -c $(CFLAGS) $*.cpp -o $(OBJDIR)/$*.o
$(CC) -MM $(CFLAGS) $*.cpp > $(OBJDIR)/$*.d
@mv -f $(OBJDIR)/$*.d $(OBJDIR)/$*.d.tmp
@sed -e 's|.*:|$(OBJDIR)/$*.o:|' < $(OBJDIR)/$*.d.tmp > $(OBJDIR)/$*.d
@sed -e 's/.*://' -e 's/\\$$//' < $(OBJDIR)/$*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $(OBJDIR)/$*.d
@rm -f $(OBJDIR)/$*.d.tmp
clean:
rm -rf $(PROG) $(OBJDIR) Curl.h Fetch.h Fetch.cpp