-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.subdirs
44 lines (34 loc) · 1.06 KB
/
Makefile.subdirs
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
CSOURCES = $(wildcard *.c)
CCSOURCES = $(wildcard *.cc)
COBJECTS = $(CSOURCES:.c=.o)
CCOBJECTS = $(CCSOURCES:.cc=.o)
MOD_OBJ = ../$(MOD_DIR).a
#lib: $(MOD_OBJ)
lib: $(COBJECTS) $(CCOBJECTS)
DEPDIR := .d
$(shell mkdir -p $(DEPDIR) >/dev/null)
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
CC=gcc
QUIET_CXX = @echo ' ' CXX ' ' $@;
QUIET_CC = @echo ' ' CC ' ' $@;
COMPILE.cc = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
POSTCOMPILE = @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
#$(MOD_OBJ): $(COBJECTS) $(CCOBJECTS)
# ar rcs $(MOD_OBJ) $(COBJECTS) $(CCOBJECTS)
%.o : %.cc
%.o : %.cc $(DEPDIR)/%.d
$(QUIET_CXX) $(COMPILE.cc) $<
$(POSTCOMPILE)
%.o : %.c
%.o : %.c $(DEPDIR)/%.d
$(QUIET_CC) $(COMPILE.c) $<
$(POSTCOMPILE)
clean:
rm -f $(COBJECTS)
rm -f $(CCOBJECTS)
rm -f $(MOD_OBJ)
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(CSOURCES))))
include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(CCSOURCES))))