/make/edam-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/edam-mk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: edam
  • Date: 2009-03-05 13:25:26 UTC
  • Revision ID: edam@waxworlds.org-20090305132526-n50e3cqq1rhs3zfo
Tags: 1.5
- replaced debug option with debug switch
- added run goal

Show diffs side-by-side

added added

removed removed

1
 
#                                                       Edam's Makefile v1.3
 
1
#                                                       Edam's Makefile v1.5
2
2
#___________________________________________________________________________
3
3
#                                                            S E T T I N G S
4
4
 
5
5
# Target binary
6
 
TARGET          = exectest
 
6
TARGET          = helloworld
7
7
 
8
8
# All source files
9
 
CC_SRCS         = 
 
9
CC_SRCS         = helloworld.cc
10
10
C_SRCS          = 
11
 
S_SRCS          = exectest.s
 
11
S_SRCS          = 
12
12
 
13
13
# Libraries
14
14
LIBRARIES       = 
15
15
 
16
 
# Debug?
17
 
DEBUG           = -g
18
 
 
19
 
# Build flags
20
 
CPPFLAGS        = $(DEBUG) -O2
21
 
ASFLAGS         = $(DEBUG) -f elf
22
 
LDFLAGS         = $(DEBUG) -Wall -s -nostartfiles
 
16
# Uncomment for debug-build
 
17
DEBUG           = 1
23
18
 
24
19
#___________________________________________________________________________
25
20
#                                                                    M E A T
27
22
# Software
28
23
AS=nasm
29
24
 
 
25
ifdef DEBUG
 
26
 
 
27
# Debug build flags
 
28
CPPFLAGS        = -g -D DEBUG
 
29
ASFLAGS         = -f elf -g -dDEBUG
 
30
LDFLAGS         = -Wall
 
31
 
 
32
else
 
33
 
 
34
# Release build flags
 
35
CPPFLAGS        = -O2
 
36
ASFLAGS         = -f elf -O2
 
37
LDFLAGS         = -Wall -s
 
38
 
 
39
endif
 
40
 
30
41
# More variables...
31
42
DEPFILE         = Depends
32
43
_SRCS           = $(CC_SRCS) $(C_SRCS) $(S_SRCS)
35
46
 
36
47
# Main rule...
37
48
$(TARGET): $(_OBJS)
38
 
        gcc -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
 
49
        g++ -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
39
50
 
40
51
#___________________________________________________________________________
41
52
#                                                                  R U L E S
42
53
 
43
 
.PHONY: all clean depend dep
 
54
.PHONY: all clean run depend dep
44
55
 
45
56
all:    clean depend $(TARGET)
46
57
 
48
59
        rm -f core $(DEPFILE) $(_OBJS)
49
60
        rm -f *~
50
61
 
 
62
run:    $(TARGET)
 
63
        ./$(TARGET)
 
64
 
51
65
depend dep:
52
66
#       makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)
53
67