/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:28:28 UTC
  • Revision ID: edam@waxworlds.org-20090305132828-fbaz7j6st7ualnge
Tags: 1.7
- puled out options to set flags for g++, as and ld

Show diffs side-by-side

added added

removed removed

1
 
#                                                       Edam's Makefile v1.3
 
1
#                                                       Edam's Makefile v1.7
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
 
LIBRARIES       = 
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
 
14
LIBRARIES       =
 
15
 
 
16
# Options (comment-out to disable)
 
17
DEBUG           = 1
 
18
CPPBUILD        = 1
 
19
#STATICLIBS     = 1
 
20
 
 
21
# Other flags
 
22
CPPFLAGS        = 
 
23
ASFLAGS         = 
 
24
LDFLAGS         = 
23
25
 
24
26
#___________________________________________________________________________
25
27
#                                                                    M E A T
27
29
# Software
28
30
AS=nasm
29
31
 
 
32
ifdef DEBUG
 
33
 
 
34
# Debug build flags
 
35
CPPFLAGS        := $(CPPFLAGS) -g -D DEBUG
 
36
ASFLAGS         := -f elf -g -dDEBUG
 
37
LDFLAGS         := -Wall $(if $(STATICLIBS), -static) $(LDFLAGS)
 
38
 
 
39
else
 
40
 
 
41
# Release build flags
 
42
CPPFLAGS        := $(CPPFLAGS) -O2
 
43
ASFLAGS         := -f elf -O2
 
44
LDFLAGS         := -Wall -s $(if $(STATICLIBS), -static) $(LDFLAGS)
 
45
 
 
46
endif
 
47
 
30
48
# More variables...
31
49
DEPFILE         = Depends
32
50
_SRCS           = $(CC_SRCS) $(C_SRCS) $(S_SRCS)
35
53
 
36
54
# Main rule...
37
55
$(TARGET): $(_OBJS)
38
 
        gcc -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
 
56
        $(if $(CPPBUILD), g++, gcc) -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
39
57
 
40
58
#___________________________________________________________________________
41
59
#                                                                  R U L E S
42
60
 
43
 
.PHONY: all clean depend dep
 
61
.PHONY: all clean run depend dep
44
62
 
45
63
all:    clean depend $(TARGET)
46
64
 
48
66
        rm -f core $(DEPFILE) $(_OBJS)
49
67
        rm -f *~
50
68
 
 
69
run:    $(TARGET)
 
70
        ./$(TARGET)
 
71
 
51
72
depend dep:
52
73
#       makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)
53
74