/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:21:22 UTC
  • Revision ID: edam@waxworlds.org-20090305132122-lwtwrlwj19z7x792
Tags: 1.02
switched compiler to g++

Show diffs side-by-side

added added

removed removed

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