/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.7
 
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
 
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         = 
 
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
25
23
 
26
24
#___________________________________________________________________________
27
25
#                                                                    M E A T
29
27
# Software
30
28
AS=nasm
31
29
 
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
 
 
48
30
# More variables...
49
31
DEPFILE         = Depends
50
32
_SRCS           = $(CC_SRCS) $(C_SRCS) $(S_SRCS)
53
35
 
54
36
# Main rule...
55
37
$(TARGET): $(_OBJS)
56
 
        $(if $(CPPBUILD), g++, gcc) -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
 
38
        gcc -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
57
39
 
58
40
#___________________________________________________________________________
59
41
#                                                                  R U L E S
60
42
 
61
 
.PHONY: all clean run depend dep
 
43
.PHONY: all clean depend dep
62
44
 
63
45
all:    clean depend $(TARGET)
64
46
 
66
48
        rm -f core $(DEPFILE) $(_OBJS)
67
49
        rm -f *~
68
50
 
69
 
run:    $(TARGET)
70
 
        ./$(TARGET)
71
 
 
72
51
depend dep:
73
52
#       makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)
74
53