forked from syllable-org/webster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makerules
49 lines (43 loc) · 1.43 KB
/
Makerules
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
#
# Makefile standard rules and default targets
#
# This makefile is supposed to be included by the main
# makefile after the following variables have been set:
#
# OBJDIR - The directory where all temporary files will be placed.
# CFLAGS - Options given to the compiler when compiling C files
# CXXFLAGS - Options given to the compiler when compiling C++ files
# OBJS - List of object files.
#
# The $(OBJDIR) varaiable will be prepended to all elements in
# the $(OBJS) list and then a new variable named DEPS will be
# initiated with all the elements from $(OBJS) with all ".o" prefixes
# replaced with ".d".
# This is a hack to disable debug output
CFLAGS += -DNDEBUG
CXXFLAGS += -DNDEBUG
OBJS := $(addprefix $(OBJDIR)/,$(OBJS))
DEPS := $(addsuffix .d, $(foreach name, $(OBJS), $(basename $(name))))
$(OBJDIR)/%.o : %.c
@echo Compiling : $<
@$(CC) $(CFLAGS) $< -o $@
$(OBJDIR)/%.o : %.cpp
@echo Compiling : $<
@$(CXX) $(CXXFLAGS) $< -o $@
$(OBJDIR)/%.o : %.s
@echo Assembling: $<
@$(CC) $(AFLAGS) -x assembler-with-cpp $< -o $@
$(OBJDIR)/%.o : %.S
@echo Assembling: $<
@$(CC) $(CFLAGS) -x assembler-with-cpp $< -o $@
# Dependency rules
$(OBJDIR)/%.d : %.c
@echo Making dependencies for : $<
@$(CC) $(CFLAGS) -M $< | sed 's%^\(.*\):%$(OBJDIR)\/\1:%' > $@
$(OBJDIR)/%.d : %.cpp
@echo Making dependencies for : $<
@$(CXX) $(CXXFLAGS) -M $< | sed 's%^\(.*\):%$(OBJDIR)\/\1:%' > $@
$(OBJDIR)/%.d : %.s
@touch $@
$(OBJDIR)/%.d : %.S
@touch $@