Skip to content

Instantly share code, notes, and snippets.

@nabijaczleweli
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabijaczleweli/83737c02e71ea5ae6554 to your computer and use it in GitHub Desktop.
Save nabijaczleweli/83737c02e71ea5ae6554 to your computer and use it in GitHub Desktop.
Indoctrinating @Nooble part 1
# I normally put this in a separate file, but v0v
ifeq "$(OS)" "Windows_NT"
devnull := nul
DLL := .dll
MKDIR := busybox mkdir
PIC :=
PREDLL =
FIND = busybox find
else
devnull := /dev/null
ifeq "$(OS)" "Darwin"
DLL := .dylib
else
DLL := .so
endif
MKDIR := mkdir
PIC := -fPIC
PREDLL = lib
FIND = find
endif
OBJ := .o
ARCH := .a
CXXAR := -Os -pedantic -pipe -fomit-frame-pointer -isystemlibyaml/include $(PIC) -std=c++14 -Isrc -fpermissive -Wno-pedantic
OUTDIR := out/
OBJDIR := $(OUTDIR)obj/
SRCDIR := src/
SOURCES = $(sort $(shell $(FIND) $(SRCDIR)$(1) -name *.cpp))
OBJECTS = $(sort $(shell $(FIND) $(OUTDIR) -name *$(OBJ)))
all : $(subst $(SRCDIR),$(OBJDIR),$(subst .cpp,$(OBJ),$(foreach mod,$(subst :, ,$(Bullet3BuildMakeModules)),$(call SOURCES,Bullet3$(mod)))))
@$(MKDIR) -p $(dir $@) || :
$(CXX) $(CXXAR) -shared -o$(OUTDIR)$(PREDLL)Bullet3$(DLL) $(subst $(SRCDIR),$(OBJDIR),$^) -L. -lopencl -Wl,--enable-stdcall-fixup
$(OBJDIR)%$(OBJ) : $(SRCDIR)%.cpp
@$(MKDIR) -p $(dir $@) || :
$(CXX) $(CXXAR) -c -o$@ $^
@nabijaczleweli
Copy link
Author

Note, that this assumes, that opencl can be found via -L.

@nabijaczleweli
Copy link
Author

Needs a (possibly shell) variable Bullet3BuildMakeModules to be set to ':' separated module names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment