diff --git a/build/GNUmakefile.example b/build/GNUmakefile.example new file mode 100644 index 00000000..d366454d --- /dev/null +++ b/build/GNUmakefile.example @@ -0,0 +1,31 @@ +# 16 october 2015 + +ifndef inlibuibuild +$(error Do not run these makefiles directly.) +endif +ifndef EXAMPLE +$(error You must specify an example to build by adding EXAMPLE=name to the command line.) +endif + +include $(OS)/GNUosspecific.mk + +CFILES += \ + examples/$(EXAMPLE)/main.c + +HFILES += \ + ui.h + +NAME = $(EXAMPLE) +SUFFIX = $(EXESUFFIX) + +# TODO merge with the one in build/GNUmakefile.test +ifeq ($(TOOLCHAIN),gcc) + LDFLAGS += -L$(OUTDIR) -lui + # tell the dynamic loader to search in the executable path for shared objects + LDFLAGS += -Wl,-rpath='$$ORIGIN' +else + # TODO is there an equivalent to -L? + LDFLAGS += $(OUTDIR)/libui.lib +endif + +include build/GNUbase$(TOOLCHAIN).mk diff --git a/examples/controlgallery/GNUmakefile b/examples/controlgallery/GNUmakefile deleted file mode 100644 index 438a5d12..00000000 --- a/examples/controlgallery/GNUmakefile +++ /dev/null @@ -1,32 +0,0 @@ -# 2 september 2015 - -OUT = controlgallery - -ifeq ($(OS),windows) -linkto = ../../out/libui.dll -CC = i686-w64-mingw32-gcc -ifeq ($(ARCH),amd64) -CC = x86_64-w64-mingw32-gcc -endif -OUT = controlgallery.exe -else -ifeq ($(OS),darwin) -linkto = ../../out/libui.dylib -else -linkto = ../../out/libui.so -endif -endif - -CFILES = \ - main.c - -OFILES = $(CFILES:%.c=%.o) - -controlgallery: $(OFILES) - $(CC) -g -o $(OUT) $(OFILES) $(linkto) - -%.o: %.c - $(CC) -c -g -o $@ $< - -clean: - rm -f $(OUT) $(OFILES) diff --git a/examples/histogram/GNUmakefile b/examples/histogram/GNUmakefile deleted file mode 100644 index 32a09a74..00000000 --- a/examples/histogram/GNUmakefile +++ /dev/null @@ -1,32 +0,0 @@ -# 2 september 2015 - -OUT = histogram - -ifeq ($(OS),windows) -linkto = ../../out/libui.dll -CC = i686-w64-mingw32-gcc -ifeq ($(ARCH),amd64) -CC = x86_64-w64-mingw32-gcc -endif -OUT = histogram.exe -else -ifeq ($(OS),darwin) -linkto = ../../out/libui.dylib -else -linkto = ../../out/libui.so -endif -endif - -CFILES = \ - main.c - -OFILES = $(CFILES:%.c=%.o) - -controlgallery: $(OFILES) - $(CC) -g -o $(OUT) $(OFILES) $(linkto) - -%.o: %.c - $(CC) -c -g -o $@ $< - -clean: - rm -f $(OUT) $(OFILES)