-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGMakefile
47 lines (39 loc) · 1.5 KB
/
GMakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Project: 3dObjLib
include MakeCommon
# Tools
CC = gcc
LibFile = ar
# Make cannot understand rules which contain RISC OS path names such as /C:Macros.h as prerequisites, so strip them from the dynamic dependencies
StripBadPre = sed -r 's@/[A-Za-z]+:[^ ]*@@g'
Delete = delete
# Toolflags:
CCCommonFlags = -c -IC: -mlibscl -mthrowback -Wall -Wextra -pedantic -std=c99 -MMD -MP -o $@
CCFlags = $(CCCommonFlags) -DNDEBUG -O3
CCDebugFlags = $(CCCommonFlags) -g -DUSE_CBDEBUG -DDEBUG_OUTPUT -DFORTIFY
LibFileFlags = -rcs $@
# GNU Make doesn't apply suffix rules to make object files in subdirectories
# if referenced by path (even if the directory name is in UnixEnv$make$sfix)
# so use addsuffix not addprefix here
ReleaseObjects = $(addsuffix .o,$(ObjectList))
DebugObjects = $(addsuffix .debug,$(ObjectList))
# Final targets:
all: @.lib$(LibName)/a @.lib$(LibName)dbg/a
@.lib$(LibName)/a: $(ReleaseObjects)
$(LibFile) $(LibFileFlags) $(ReleaseObjects)
@.lib$(LibName)dbg/a: $(DebugObjects)
$(LibFile) $(LibFileFlags) $(DebugObjects)
# User-editable dependencies:
# All of these suffixes must also be specified in UnixEnv$*$sfix
.SUFFIXES: .o .c .debug
.c.o:
${CC} $(CCFlags) -MF $*T.d $<
$(StripBadPre) < $*T.d >$*.d
$(Delete) d.$*T
.c.debug:
${CC} $(CCDebugFlags) -MF $*TD.d $<
$(StripBadPre) < $*TD.d >$*D.d
$(Delete) d.$*TD
# These files are generated during compilation to track C header #includes.
# It's not an error if they don't exist.
-include $(addsuffix .d,$(ObjectList))
-include $(addsuffix D.d,$(ObjectList))