edid-decode: improve GTF/CVT failure messages
[edid-decode.git] / Makefile
blob375fedb8fe255ea19aeee5e73812dd6dcf3e8bac
1 ifeq ($(OS),Windows_NT)
2 bindir ?= /usr/bin
3 mandir ?= /usr/share/man
4 else
5 UNAME_S := $(shell uname -s)
6 ifeq ($(UNAME_S),Darwin)
7 bindir ?= /usr/local/sbin
8 mandir ?= /usr/local/share/man
9 else
10 bindir ?= /usr/bin
11 mandir ?= /usr/share/man
12 endif
13 endif
15 EMXX ?= em++
17 SOURCES = $(wildcard *.cpp)
18 OBJECTS := $(patsubst %.cpp, %.o, $(SOURCES))
19 EMOBJECTS := $(patsubst %.cpp, emscripten/%.o, $(SOURCES))
21 WARN_FLAGS = -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wimplicit-fallthrough
23 all: edid-decode
25 sha = -DSHA=$(shell if test -d .git ; then git rev-parse --short=12 HEAD ; fi)
26 date = -DDATE=$(shell if test -d .git ; then TZ=UTC git show --quiet --date='format-local:"%F %T"' --format='%cd'; fi)
28 edid-decode: $(OBJECTS)
29 $(CXX) $(LDFLAGS) -g -o $@ $(OBJECTS) -lm
31 edid-decode.js: emscripten/edid-decode.js
33 emscripten/edid-decode.js: $(EMOBJECTS)
34 $(EMXX) $(LDFLAGS) -s EXPORTED_FUNCTIONS='["_parse_edid"]' -s EXPORTED_RUNTIME_METHODS='["ccall", "cwrap"]' -o $@ $(EMOBJECTS) -lm
36 %.o: %.cpp edid-decode.h oui.h Makefile
37 $(CXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(WARN_FLAGS) -g $(sha) $(date) -o $@ -c $<
39 emscripten/%.o: %.cpp edid-decode.h oui.h Makefile
40 $(EMXX) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(WARN_FLAGS) $(sha) $(date) -o $@ -c $<
42 clean:
43 rm -f *.o emscripten/*.o
44 rm -f edid-decode emscripten/edid-decode.js emscripten/edid-decode.wasm
46 install:
47 mkdir -p $(DESTDIR)$(bindir)
48 install -m 0755 edid-decode $(DESTDIR)$(bindir)
49 mkdir -p $(DESTDIR)$(mandir)/man1
50 install -m 0644 edid-decode.1 $(DESTDIR)$(mandir)/man1