-
Notifications
You must be signed in to change notification settings - Fork 67
/
Makefile
94 lines (79 loc) · 2.96 KB
/
Makefile
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
#!/usr/bin/env make -f
# Makefile to build and test screenresolution
# Monday August 29, 2011
# John Ford <[email protected]>
# ToDo:
# -find a standard way to check on resolution that *isn't* screenresolution
# -use program from above to figure out original resolution
# -convert test target to a shell script
# -figure out of lipo is the best way to make a universal binary on cmdline
PREFIX=/usr/local
ORIG_RES=1920x1200x32
TEST_RES=800x600x32
VERSION=1.7dev
CC=clang
PACKAGE_BUILD=/usr/bin/pkgbuild
ARCH_FLAGS=-arch i386 -arch x86_64
.PHONY: build
build: screenresolution
screenresolution: main.o cg_utils.o
$(CC) $(CPPFLAGS) $(CFLAGS) $(ARCH_FLAGS) -framework Foundation -framework ApplicationServices $^ -o $@
%.o: %.c version.h
$(CC) $(CPPFLAGS) $(CFLAGS) $(ARCH_FLAGS) $< -c -o $@
version.h:
sed -e "s/@VERSION@/\"$(VERSION)\"/" < version-tmpl.h > version.h
clean:
rm -f screenresolution *.o \
screenresolution-$(VERSION).pkg screenresolution-$(VERSION).dmg \
version.h
rm -rf pkgroot dmgroot
reallyclean: clean
rm -f *.pkg *.dmg
test: screenresolution
@echo Going to set screen resolutions between $(ORIG_RES) and $(TEST_RES)
./screenresolution get | wc -l | grep 2
./screenresolution get
./screenresolution set $(TEST_RES) $(TEST_RES)
sleep 1
./screenresolution get | grep "Display 0: $(TEST_RES)"
./screenresolution get | grep "Display 1: $(TEST_RES)"
./screenresolution set $(ORIG_RES) $(ORIG_RES)
sleep 1
./screenresolution get | grep "Display 0: $(ORIG_RES)"
./screenresolution get | grep "Display 1: $(ORIG_RES)"
./screenresolution set skip $(TEST_RES)
sleep 1
./screenresolution get | grep "Display 0: $(ORIG_RES)"
./screenresolution get | grep "Display 1: $(TEST_RES)"
./screenresolution set $(ORIG_RES) $(ORIG_RES)
sleep 1
./screenresolution get | grep "Display 0: $(ORIG_RES)"
./screenresolution get | grep "Display 1: $(ORIG_RES)"
./screenresolution set $(TEST_RES)
sleep 1
./screenresolution get | grep "Display 0: $(TEST_RES)"
./screenresolution get | grep "Display 1: $(ORIG_RES)"
@echo If you got this far, I think it works!
./screenresolution set $(ORIG_RES) $(ORIG_RES)
@echo resolution back to normal
install: screenresolution
mkdir -p $(DESTDIR)/$(PREFIX)/bin
install -s -m 0755 screenresolution \
$(DESTDIR)/$(PREFIX)/bin/
pkg: screenresolution
mkdir -p pkgroot/$(PREFIX)/bin
install -s -m 0755 screenresolution \
pkgroot/$(PREFIX)/bin
$(PACKAGE_BUILD) --root pkgroot/ --identifier com.johnhford.screenresolution \
--version $(VERSION) "screenresolution-$(VERSION).pkg"
rm -f screenresolution.pkg
ln -s screenresolution-$(VERSION).pkg screenresolution.pkg
dmg: pkg
mkdir -p dmgroot
cp screenresolution-$(VERSION).pkg dmgroot/
rm -f screenresolution-$(VERSION).dmg
hdiutil makehybrid -hfs -hfs-volume-name "screenresolution $(VERSION)" \
-o "screenresolution-$(VERSION).dmg" dmgroot/
rm -f screenresolution.dmg
ln -s screenresolution-$(VERSION).dmg screenresolution.dmg
.PHONY: test pkg dmg install build clean reallyclean