From c204e47b7268fd27a72f1de8e382fa9fe673f341 Mon Sep 17 00:00:00 2001 From: Florent Clairambault Date: Fri, 1 Jan 2016 23:19:14 +0100 Subject: [PATCH] Various fixes around makefiles * $PREFIX is uppercase (I have no idea why I put it lowercase before). * "install" rules is OS specific and moved to new OS specific files. So that they can be included last. * "examples" rule defines the list of examples to execute. * Travis launches the "test" rule. --- .travis.yml | 9 ++------- GNUmakefile | 15 ++++----------- build/GNUmakefile.libui | 3 +++ darwin/GNUinstall.mk | 9 +++++++++ unix/GNUinstall.mk | 8 ++++++++ windows/GNUinstall.mk | 3 +++ 6 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 darwin/GNUinstall.mk create mode 100644 unix/GNUinstall.mk create mode 100644 windows/GNUinstall.mk diff --git a/.travis.yml b/.travis.yml index d0c9470c..0d4309bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,10 +7,5 @@ script: - sudo apt-get update - sudo apt-get install libgtk-3-dev -y || sudo apt-cache search libgtk3 - make -f GNUmakefile - - make -f GNUmakefile example EXAMPLE=histogram - -# Only working things are added here... Some interesting commands would be: -# - make -f GNUmakefile examples -# - make -f GNUmakefile test -# -# But they both won't work + - make -f GNUmakefile examples + - make -f GNUmakefile test diff --git a/GNUmakefile b/GNUmakefile index 162eae52..319ff4d4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,11 +8,6 @@ MAKEFLAGS += --no-print-directory OUTDIR = out OBJDIR = .obj -# default install prefix is /usr -ifndef prefix - prefix=/usr -endif - # MAME does this so :/ ifeq ($(OS),Windows_NT) OS = windows @@ -64,12 +59,10 @@ example: libui # TODO examples rule? --> That's it right ? examples: - for d in $$(ls examples); do $(MAKE) -f GNUmakefile example EXAMPLE=$$d ; done + @$(MAKE) -f GNUmakefile example EXAMPLE=histogram + #@$(MAKE) -f GNUmakefile example EXAMPLE=controlgallery .PHONY: examples -install: libui - cp out/libui.so $(DESTDIR)$(prefix)/lib/libui.so.0 - ln -s libui.so.0 $(DESTDIR)$(prefix)/lib/libui.so - cp ui.h ui_unix.h $(DESTDIR)$(prefix)/include/ui.h - +install: + @$(MAKE) -f build/GNUmakefile.libui install inlibuibuild=1 diff --git a/build/GNUmakefile.libui b/build/GNUmakefile.libui index 936fc2b6..a4666720 100644 --- a/build/GNUmakefile.libui +++ b/build/GNUmakefile.libui @@ -39,3 +39,6 @@ else endif include build/GNUbase$(TOOLCHAIN).mk + +# install rule is OS specific +include $(OS)/GNUinstall.mk diff --git a/darwin/GNUinstall.mk b/darwin/GNUinstall.mk new file mode 100644 index 00000000..13da37f5 --- /dev/null +++ b/darwin/GNUinstall.mk @@ -0,0 +1,9 @@ +ifndef PREFIX + PREFIX=/usr +endif + +# Incorrect for Mac Os X, this should be easy to fix +install: $(OUT) + cp $(OUT) $(DESTDIR)$(PREFIX)/lib/libui.0.dylib + ln -s libui.so.0 $(DESTDIR)$(PREFIX)/lib/libui.so + cp ui.h ui_$(OS).h $(DESTDIR)$(PREFIX)/include/ diff --git a/unix/GNUinstall.mk b/unix/GNUinstall.mk new file mode 100644 index 00000000..634dbc06 --- /dev/null +++ b/unix/GNUinstall.mk @@ -0,0 +1,8 @@ +ifndef PREFIX + PREFIX=/usr +endif + +install: $(OUT) + cp $(OUT) $(DESTDIR)$(PREFIX)/lib/libui.so.0 + ln -fs libui.so.0 $(DESTDIR)$(PREFIX)/lib/libui.so + cp ui.h ui_$(OS).h $(DESTDIR)$(PREFIX)/include/ diff --git a/windows/GNUinstall.mk b/windows/GNUinstall.mk new file mode 100644 index 00000000..1d783c01 --- /dev/null +++ b/windows/GNUinstall.mk @@ -0,0 +1,3 @@ +install: + @echo "No install for windows !" + @exit 1