Added a makefile for examples.
This commit is contained in:
parent
3e0b6fdff4
commit
d05b374a05
|
@ -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
|
|
@ -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)
|
|
@ -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)
|
Loading…
Reference in New Issue