-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
72 lines (56 loc) · 1.83 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
########################################################################
##
## Raithlin Consulting Inc. p2pmem test suite
## Copyright (c) 2017, Raithlin Consulting Inc.
##
## This program is free software; you can redistribute it and/or modify it
## under the terms and conditions of the GNU General Public License,
## version 2, as published by the Free Software Foundation.
##
## This program is distributed in the hope it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
## more details.
##
########################################################################
OBJDIR=build
DESTDIR ?=
LIBARGCONFIGDIR=libargconfig
CPPFLAGS=-Iinc -Ibuild
CFLAGS=-std=gnu99 -g -O2 -fPIC -Wall -Werror -I$(LIBARGCONFIGDIR)/inc
DEPFLAGS= -MT $@ -MMD -MP -MF $(OBJDIR)/$*.d
LDLIBS+= -lpthread
EXE=p2pmem-test
SRCS=$(wildcard src/*.c)
OBJS=$(addprefix $(OBJDIR)/, $(patsubst %.c,%.o, $(SRCS)))
PREFIX=/usr/local/bin/
ifneq ($(V), 1)
Q=@
MAKEFLAGS+=-s --no-print-directory
else
NQ=:
endif
compile: $(EXE)
install: $(EXE)
install $(EXE) $(PREFIX)
clean:
@$(NQ) echo " CLEAN $(EXE)"
$(Q)rm -rf $(EXE) build *~ ./src/*~
$(Q)$(MAKE) -C $(LIBARGCONFIGDIR) clean
$(OBJDIR)/version.h $(OBJDIR)/version.mk: FORCE $(OBJDIR)
@$(SHELL_PATH) ./VERSION-GEN
$(OBJDIR)/src/main.o: $(OBJDIR)/version.h
-include $(OBJDIR)/version.mk
$(OBJDIR):
$(Q)mkdir -p $(OBJDIR)/src
$(OBJDIR)/%.o: %.c | $(OBJDIR)
@$(NQ) echo " CC $<"
$(Q)$(COMPILE.c) $(DEPFLAGS) $< -o $@
$(LIBARGCONFIGDIR)/libargconfig.a: FORCE
@$(NQ) echo " MAKE $@"
$(Q)$(MAKE) -C $(LIBARGCONFIGDIR)
$(EXE): $(OBJS) $(LIBARGCONFIGDIR)/libargconfig.a
@$(NQ) echo " LD $@"
$(Q)$(LINK.o) $^ $(LDLIBS) -o $@
.PHONY: clean compile install FORCE
-include $(patsubst %.o,%.d,$(OBJS))