github.com/ckxng/wakeup@v0.0.0-20190105202853-90356a5f5a15/Makefile (about)

     1  .PHONY: detect_os Linux Darwin clean
     2  
     3  export GOPATH=$(PWD)
     4  UNAME_S = $(shell uname -s)
     5  
     6  ifeq ($(UNAME_S), Linux)
     7  	INC=-I. \
     8  		-I/usr/include/gtk-2.0 \
     9  		-I/usr/include/glib-2.0 \
    10  		-I/usr/include/cairo \
    11  		-I/usr/include/pango-1.0 \
    12  		-I/usr/include/gdk-pixbuf-2.0 \
    13  		-I/usr/include/atk-1.0 \
    14  		-I/usr/lib/x86_64-linux-gnu/glib-2.0/include \
    15  		-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include \
    16  		-I/usr/lib/i386-linux-gnu/gtk-2.0/include \
    17  		-I/usr/lib/i386-linux-gnu/glib-2.0/include \
    18  		-I/usr/lib64/glib-2.0/include \
    19  		-I/usr/lib64/gtk-2.0/include
    20  	export CC=gcc $(INC)
    21  	export CGO_LDFLAGS=-L $(PWD)/Release -lcef
    22  else ifeq ($(UNAME_S), Darwin)
    23  	INC=-I.
    24  	export CGO_ENABLED=1
    25  	export CC=clang $(INC)
    26  	export CGO_LDFLAGS=-F$(PWD)/Release/tmp -framework Cocoa -framework cef
    27  endif
    28  
    29  detect_os:
    30  	make $(UNAME_S)
    31  
    32  Linux:
    33  	clear
    34  	go install gtk
    35  	go install cef
    36  	go test -ldflags "-r $(PWD)/Release" src/tests/cef_test.go
    37  	go build -ldflags "-r ." -o Release/cef2go src/main_linux.go
    38  	cd Release && ./cef2go && cd ../
    39  
    40  Darwin:
    41  	clear
    42  	
    43  	@# Required for linking. Go doesn't allow framework name
    44  	@# to contain spaces, so we're making a copy of the framework
    45  	@# without spaces.
    46  	@if [ ! -d Release/tmp ]; then \
    47  		echo Copying CEF framework directory to Release/tmp ;\
    48  		mkdir -p Release/tmp ;\
    49  		cp -rf Release/cef2go.app/Contents/Frameworks/Chromium\ Embedded\ Framework.framework Release/tmp/cef.framework ;\
    50  		mv Release/tmp/cef.framework/Chromium\ Embedded\ Framework Release/tmp/cef.framework/cef ;\
    51  	fi
    52  	go install -x cef
    53  	@# CEF requires specific app bundle / directory structure
    54  	@# on OSX, but Go doesn't allow for such thing when 
    55  	@# running test. So turning off test.
    56  	@# go test -ldflags "-r $(PWD)/Release" src/tests/cef_test.go
    57  	rm -f Release/cef2go.app/Contents/MacOS/cef2go
    58  	go build -x -ldflags "-r ." -o Release/cef2go.app/Contents/MacOS/cef2go src/main_darwin.go
    59  	install_name_tool -change @executable_path/Chromium\ Embedded\ Framework @executable_path/../Frameworks/Chromium\ Embedded\ Framework.framework/Chromium\ Embedded\ Framework Release/cef2go.app/Contents/MacOS/cef2go
    60  	cp -f Release/example.html Release/cef2go.app/Contents/MacOS/example.html
    61  	cd Release/cef2go.app/Contents/MacOS && ./cef2go && cd ../../../../
    62  
    63  clean:
    64  	clear
    65  	go clean -i cef