/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:26:41 UTC
  • Revision ID: edam@waxworlds.org-20090305132641-42u18q8sg2lx966x
Tags: 1.6
- added cpp build switch
- added static linking switch

Show diffs side-by-side

added added

removed removed

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