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