/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:23:20 UTC
  • Revision ID: edam@waxworlds.org-20090305132320-hjmtab4k0hr9i147
Tags: 1.3
- added propper header
- added debug options
- added libraries option
- added (currently unused) dependencies

Show diffs side-by-side

added added

removed removed

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