-
Notifications
You must be signed in to change notification settings - Fork 2
/
GNUmakefile
201 lines (164 loc) · 7.58 KB
/
GNUmakefile
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Needed for space handling in paths
empty :=
space := $(empty) $(empty)
safedir = $(subst _GNU_MAKEFILE_SPACE_,$(space),$(dir $(subst $(space),_GNU_MAKEFILE_SPACE_,$1)))
# Nicer build output
ifdef VERBOSE
VERBOSE_ECHO := @ echo
QUIET_ECHO := @ true
VERBOSE_SHOW :=
else
VERBOSE_ECHO := @ true
QUIET_ECHO := @ echo
VERBOSE_SHOW := @
endif
CFLAGS := -pipe
# These commands and flags were determined by looking at the commands
# that Xcode runs for the Xcode MenuMeters project
# Build both i386 and x86_64 architecture objects
CFLAGS := $(CFLAGS) -arch x86_64 -arch i386
# The code requires some c99 features
CFLAGS := $(CFLAGS) -std=c99
# Optimizations
CFLAGS := $(CFLAGS) -O3
# Enable GC, required for Mac OS X 10.5 and later
CFLAGS := $(CFLAGS) -fobjc-gc
# I think some features that the code uses requires this
CFLAGS := $(CFLAGS) -mmacosx-version-min=10.5
# I guess we want all warnings
CFLAGS := $(CFLAGS) -Wall -Wshorten-64-to-32 -Werror
# Private frameworks are used
# CFLAGS := $(CFLAGS) -F /System/Library/PrivateFrameworks
# Required include path
CFLAGS := $(CFLAGS) -ICommon
# Force include of a common header file
CFLAGS := $(CFLAGS) -include MenuMeters.pch
LINKFLAGS := -pipe
LINKFLAGS := $(LINKFLAGS) -arch x86_64 -arch i386
LINKFLAGS := $(LINKFLAGS) -F /System/Library/PrivateFrameworks
.PHONY: all
all: installer
.PHONY: binaries
binaries: InstallTool MenuMeters MenuMeterCPU MenuMeterDisk MenuMeterMem \
MenuMeterNet MenuMeterDefaults MenuMeters\ Installer
.PHONY: nibs
nibs: build/nib/Installer/Resources/English.lproj/Installer.nib \
build/nib/Installer/Resources/French.lproj/Installer.nib \
build/nib/Installer/Resources/German.lproj/Installer.nib \
build/nib/Installer/Resources/Italian.lproj/Installer.nib \
build/nib/Installer/Resources/Japanese.lproj/Installer.nib \
build/nib/Installer/Resources/nl.lproj/Installer.nib \
build/nib/Installer/Resources/zh_CN.lproj/Installer.nib \
build/nib/PrefPane/English.lproj/MenuMetersPref.nib \
build/nib/PrefPane/French.lproj/MenuMetersPref.nib \
build/nib/PrefPane/German.lproj/MenuMetersPref.nib \
build/nib/PrefPane/Italian.lproj/MenuMetersPref.nib \
build/nib/PrefPane/Japanese.lproj/MenuMetersPref.nib \
build/nib/PrefPane/nl.lproj/MenuMetersPref.nib \
build/nib/PrefPane/zh_CN.lproj/MenuMetersPref.nib
build/obj/%.o: %.m
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Compiling $@ ...
$(VERBOSE_SHOW) gcc $(CFLAGS) -c "$^" -o "$@"
build/nib/%.nib: %.nib
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Compiling $@ ...
$(VERBOSE_SHOW) /usr/bin/ibtool --strip "$@" --output-format human-readable-text "$^"
.PHONY: InstallTool
InstallTool: build/bin/InstallTool
build/bin/InstallTool: build/obj/Installer/InstallTool.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc $(LINKFLAGS) -o $@ $^ -framework Cocoa
.PHONY: MenuMeterDefaults
MenuMeterDefaults: build/bin/MenuMeterDefaults
build/bin/MenuMeterDefaults: build/obj/Common/MenuMeterDefaults.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc -bundle $(LINKFLAGS) -o $@ $^ -framework Cocoa
.PHONY: MenuMeters
MenuMeters: build/bin/MenuMeters
build/bin/MenuMeters: build/obj/Common/MenuMeterDefaults.o \
build/obj/Common/MenuMeterPowerMate.o \
build/obj/PrefPane/MenuMetersPref.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc -bundle $(LINKFLAGS) -o $@ $^ -framework Cocoa -framework IOKit -framework SystemConfiguration -framework PreferencePanes
.PHONY: MenuMeterCPU
MenuMeterCPU: build/bin/MenuMeterCPU
build/bin/MenuMeterCPU: build/obj/MenuExtras/MenuMeterCPU/MenuMeterCPUView.o \
build/obj/MenuExtras/MenuMeterCPU/MenuMeterCPUExtra.o \
build/obj/MenuExtras/MenuMeterCPU/MenuMeterCPUStats.o \
build/obj/MenuExtras/MenuMeterCPU/MenuMeterUptime.o \
build/obj/Common/MenuMeterPowerMate.o \
build/obj/Common/MenuMeterWorkarounds.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc -bundle $(LINKFLAGS) -o $@ $^ -framework SystemUIPlugin -framework Cocoa -framework Carbon -framework IOKit
.PHONY: MenuMeterDisk
MenuMeterDisk: build/bin/MenuMeterDisk
build/bin/MenuMeterDisk: \
build/obj/MenuExtras/MenuMeterDisk/MenuMeterDiskView.o \
build/obj/MenuExtras/MenuMeterDisk/MenuMeterDiskExtra.o \
build/obj/MenuExtras/MenuMeterDisk/MenuMeterDiskIO.o \
build/obj/MenuExtras/MenuMeterDisk/MenuMeterDiskSpace.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc -bundle $(LINKFLAGS) -o $@ $^ -framework SystemUIPlugin -framework Cocoa -framework Carbon -framework IOKit
.PHONY: MenuMeterNet
MenuMeterNet: build/bin/MenuMeterNet
build/bin/MenuMeterNet: build/obj/MenuExtras/MenuMeterNet/MenuMeterNetExtra.o \
build/obj/MenuExtras/MenuMeterNet/MenuMeterNetView.o \
build/obj/MenuExtras/MenuMeterNet/MenuMeterNetStats.o \
build/obj/MenuExtras/MenuMeterNet/MenuMeterNetConfig.o \
build/obj/MenuExtras/MenuMeterNet/MenuMeterNetPPP.o \
build/obj/Common/MenuMeterWorkarounds.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc -bundle $(LINKFLAGS) -o $@ $^ -framework SystemUIPlugin -framework Cocoa -framework IOKit -framework SystemConfiguration
.PHONY: MenuMeterMem
MenuMeterMem: build/bin/MenuMeterMem
build/bin/MenuMeterMem: build/obj/MenuExtras/MenuMeterMem/MenuMeterMemView.o \
build/obj/MenuExtras/MenuMeterMem/MenuMeterMemExtra.o \
build/obj/MenuExtras/MenuMeterMem/MenuMeterMemStats.o \
build/obj/Common/MenuMeterWorkarounds.o
@mkdir -p "$(call safedir,$@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc -bundle $(LINKFLAGS) -o $@ $^ -framework SystemUIPlugin -framework Cocoa -framework Carbon
.PHONY: MenuMeters\ Installer
MenuMeters\ Installer: build/bin/MenuMeters\ Installer
build/bin/MenuMeters\ Installer: build/obj/Installer/InstallerApp.o \
build/obj/Installer/InstallerAppMain.o
@mkdir -p "$(dir $@)"
$(QUIET_ECHO) Linking $@ ...
$(VERBOSE_SHOW) gcc $(LINKFLAGS) -o "$@" $^ -framework Cocoa -framework Security
DMG_DOCS := build/dmgvolroot/MenuMeters\ Read\ Me.rtf \
build/dmgvolroot/MenuMeters\ FAQ.rtf \
build/dmgvolroot/History.txt \
build/dmgvolroot/Website\ -\ Donate.webloc \
build/dmgvolroot/Artistic\ License.rtf \
build/dmgvolroot/GNU\ General\ Public\ License.rtf
build/dmgvolroot/Artistic\ License.rtf: MenuCracker/Artistic\ License.rtf
@mkdir -p "$(call safedir,$@)"
@cp -a "$^" "$@"
build/dmgvolroot/%.rtf: Docs/%.rtf
@mkdir -p "$(call safedir,$@)"
@cp -a "$^" "$@"
build/dmgvolroot/%.txt: Docs/%.txt
@mkdir -p "$(call safedir,$@)"
@cp -a "$^" "$@"
build/dmgvolroot/%.webloc: Docs/%.webloc
@mkdir -p "$(call safedir,$@)"
@cp -a "$^" "$@"
.PHONY: dmg
dmg: build/MenuMeters\ Installer.dmg
build/MenuMeters\ Installer.dmg: installer $(DMG_DOCS)
$(QUIET_ECHO) Building installer image $@ ...
$(VERBOSE_SHOW) /usr/bin/hdiutil create -ov -srcfolder "build/dmgvolroot" -volname "MenuMeters 1.BJI" "build/MenuMeters"
.PHONY: clean
clean:
$(QUIET_ECHO) Cleaning ...
$(VERBOSE_SHOW) rm -rf build
# Moved installer targets into a separate Makefile to make this file
# easier to read and deal with
include Installer.gmake