aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 571e61da7cce5a27c2d727f2b0951f9b34ff2929 (plain)
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
PACKAGE = monitor-edid
VERSION = 1.5
FILES = $(shell ls | grep -v CVS | grep -vF .tar)

ARCH	:= $(patsubst i%86,i386,$(shell uname -m))
ARCH	:= $(patsubst sparc%,sparc,$(ARCH))
ARCH	:= $(patsubst amd64,x86_64,$(ARCH))

ifeq (i386,$(ARCH))
HAS_VBE	= y
endif
ifeq (x86_64,$(ARCH))
HAS_VBE = y
endif
ifeq (ia64,$(ARCH))
HAS_VBE = y
endif
ifeq (ppc,$(ARCH))
HAS_OPEN_FIRMWARE = y
endif
ifeq (ppc64,$(ARCH))
HAS_OPEN_FIRMWARE = y
endif

TARGETS	= monitor-get-edid cvt

CFLAGS = -O -Wall -g
OBJS = monitor-get-edid.c

ifeq (i386,$(ARCH))
OBJS += lrmi.o
endif
ifeq (y,$(HAS_VBE))
OBJS += vbe.o libint10.a libx86emu.a
else
ifeq (y,$(HAS_OPEN_FIRMWARE))
OBJS += open_firmware.o minifind.o
else
$(error "can't access EDID since neither VBE nor open firmware supported")
endif
endif


all: $(TARGETS)

cvt: LDFLAGS += -lm

monitor-get-edid: $(OBJS)

libx86emu.a: x86emu/*.c
	$(MAKE) -C x86emu

libint10.a: int10/*.c
	$(MAKE) -C int10

clean:
	$(MAKE) -C int10 clean
	$(MAKE) -C x86emu clean
	$(RM) $(TARGETS) *.a *.o *~
	rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.bz2


# rules to build a test rpm

localsrpm: localdist
	rpm -ts $(PACKAGE)-$(VERSION).tar.bz2

localrpm: localdist buildrpm

localdist: cleandist dir localcopy tar

cleandist: clean

dir:
	mkdir $(PACKAGE)-$(VERSION)

localcopy:
	tar c $(FILES) | tar x -C $(PACKAGE)-$(VERSION)

tar:
	tar cvf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION)
	bzip2 -9vf $(PACKAGE)-$(VERSION).tar
	rm -rf $(PACKAGE)-$(VERSION)

buildrpm:
	rpm -ta $(PACKAGE)-$(VERSION).tar.bz2