/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to common.mk

  • Committer: Suren A. Chilingaryan
  • Date: 2011-02-13 02:07:11 UTC
  • Revision ID: csa@dside.dyndns.org-20110213020711-y9bjh3n4ke6p4t4n
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Compiler and default flags
 
2
CC ?= gcc
 
3
CFLAGS ?= -O2
 
4
 
 
5
 
 
6
# Defaults for directories
 
7
ROOTDIR ?= $(shell pwd)
 
8
 
 
9
INCDIR ?= $(ROOTDIR)
 
10
BINDIR ?= $(ROOTDIR)
 
11
LIBDIR ?= $(ROOTDIR)
 
12
OBJDIR ?= $(ROOTDIR)
 
13
DEPENDDIR ?= $(ROOTDIR)
 
14
 
 
15
CXXFLAGS += $(addprefix -I ,$(INCDIR))
 
16
CFLAGS += $(addprefix -I ,$(INCDIR))
 
17
 
 
18
# Source files in this directory
 
19
SRC = $(wildcard *.cpp)
 
20
SRCC = $(wildcard *.c)
 
21
 
 
22
# Corresponding object files 
 
23
OBJ = $(addprefix $(OBJDIR)/,$(SRC:.cpp=.o))
 
24
OBJ += $(addprefix $(OBJDIR)/,$(SRCC:.c=.o))
 
25
 
 
26
# Corresponding dependency files
 
27
DEPEND = $(addprefix $(DEPENDDIR)/,$(SRC:.cpp=.d)) 
 
28
DEPEND += $(addprefix $(DEPENDDIR)/,$(SRCC:.c=.d)) 
 
29
 
 
30
# This makes Verbose easier. Just prefix $(Q) to any command
 
31
ifdef VERBOSE
 
32
        Q ?= 
 
33
else
 
34
        Q ?= @
 
35
endif
 
36
 
 
37
###############################################################
 
38
# Target definitions
 
39
 
 
40
# Target for automatic dependency generation
 
41
depend: $(DEPEND) $(DEPENDC);
 
42
 
 
43
# This rule generates a dependency makefile for each source
 
44
$(DEPENDDIR)/%.d: %.c
 
45
        @echo -e "DEPEND \t$<"
 
46
        $(Q)$(CC) $(addprefix -I ,$(INCDIR)) -MM -MF $@ \
 
47
                -MT $(OBJDIR)/$(<:.c=.o) -MT $@ $< 
 
48
 
 
49
# This includes the automatically 
 
50
# generated dependency files
 
51
-include $(DEPEND)
 
52
 
 
53
$(OBJDIR)/%.o: %.c
 
54
        @echo -e "CC \t$<"
 
55
        $(Q)@$(CC) $(CFLAGS) -c -o $@ $<