Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tutorial makefile #9

Merged
merged 2 commits into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 103 additions & 30 deletions doc/source/tutorial/1_basic_concepts/Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,107 @@
# Makefile for building Tutorial code from the CARLsim library

# NOTE: need to tell CARLsim where to find the user.mk
USER_MK_PATH = ../../../../
include $(USER_MK_PATH)user.mk

# list all targets in this directory
local_targets := basic_concepts
output := *.dot *.dat *.log *.csv results/*

# we are compiling from carlsim lib
CARLSIM_FLAGS += -I$(CARLSIM_LIB_DIR)/include/kernel \
-I$(CARLSIM_LIB_DIR)/include/interface \
-I$(CARLSIM_LIB_DIR)/include/spike_monitor \
-I$(CARLSIM_LIB_DIR)/include/group_monitor \
-I$(CARLSIM_LIB_DIR)/include/connection_monitor \
-I$(CARLSIM_LIB_DIR)/include/spike_generators \
-I$(CARLSIM_LIB_DIR)/include/visual_stimulus \
-I$(CARLSIM_LIB_DIR)/include/simple_weight_tuner
CARLSIM_LIBS += -L$(CARLSIM_LIB_DIR)/lib -lCARLsim

.PHONY: all clean distclean
all: $(local_targets)
# compile from CARLsim lib

# list all rules, one per target
basic_concepts: main_basic_concepts.cpp
$(NVCC) $(CARLSIM_INCLUDES) $(CARLSIM_FLAGS) $(CARLSIM_LFLAGS) $< -o $@ $(CARLSIM_LIBS)
##----------------------------------------------------------------------------##
##
## CARLsim4 Project Makefile
## -------------------------
##
## Authors: Michael Beyeler <[email protected]>
## Kristofor Carlson <[email protected]>
##
## Institute: Cognitive Anteater Robotics Lab (CARL)
## Department of Cognitive Sciences
## University of California, Irvine
## Irvine, CA, 92697-5100, USA
##
## Version: 03/31/2016
##
##----------------------------------------------------------------------------##

################################################################################
# Start of user-modifiable section
################################################################################

# In this section, specify all files that are part of the project.

# Name of the binary file to be created.
# NOTE: There must be a corresponding .cpp file named main_$(proj_target).cpp!
proj_target := basic_concepts

# Directory where all include files reside. The Makefile will automatically
# detect and include all .h files within that directory.
proj_inc_dir := inc

# Directory where all source files reside. The Makefile will automatically
# detect and include all .cpp and .cu files within that directory.
proj_src_dir := src

################################################################################
# End of user-modifiable section
################################################################################


#------------------------------------------------------------------------------
# Include configuration file
#------------------------------------------------------------------------------

# NOTE: If your CARLsim4 installation does not reside in the default path, make
# sure the environment variable CARLSIM4_INSTALL_DIR is set.
ifneq ($(CARLSIM4_INSTALL_DIR),)
CARLSIM4_INC_DIR := $(CARLSIM4_INSTALL_DIR)/inc
else
CARLSIM4_INC_DIR := /usr/local/include/carlsim
endif

# include compile flags etc.
include $(CARLSIM4_INC_DIR)/configure.mk


#------------------------------------------------------------------------------
# Build local variables
#------------------------------------------------------------------------------

main_src_file := $(proj_src_dir)/main_$(proj_target).cpp

# build list of all .cpp, .cu, and .h files (but don't include main_src_file)
cpp_files := $(wildcard $(proj_src_dir)/*.cpp)
cpp_files := $(filter-out $(main_src_file),$(cpp_files))
cu_files := $(wildcard $(proj_src_dir)/src/*.cu)
inc_files := $(wildcard $(proj_inc_dir)/*.h)

# compile .cpp files to -cpp.o, and .cu files to -cu.o
obj_files := $(patsubst %.cpp, %-cpp.o, $(cpp_files))
obj_files += $(patsubst %.cu, %-cu.o, $(cu_files))

# handled by clean and distclean
clean_files := $(obj_files) $(proj_target)
distclean_files := $(clean_files) results/* *.dot *.dat *.csv *.log


#------------------------------------------------------------------------------
# Project targets and rules
#------------------------------------------------------------------------------

.PHONY: $(proj_target) clean distclean help
default: $(proj_target)


$(proj_target): $(main_src_file) $(inc_files) $(cpp_files) $(obj_files)
$(NVCC) $(CARLSIM4_INC) $(CARLSIM4_LD) $(obj_files) $< -o $@

$(proj_src_dir)/%-cpp.o: $(proj_src_dir)/%.cpp $(inc_files)
$(CXX) -c $(CXXINCFL) $(CXXFL) $< -o $@

$(proj_src_dir)/%-cu.o: $(proj_src_dir)/%.cu $(inc_files)
$(NVCC) -c $(NVCCINCFL) $(SIMINCFL) $(NVCCFL) $< -o $@

clean:
$(RM) $(local_targets)
$(RM) $(clean_files)

distclean:
$(RM) $(local_targets) $(output)
$(RM) $(distclean_files)

help:
$(info CARLsim4 Test Suite options:)
$(info )
$(info make Compiles test suite
$(info make clean Cleans out all object files)
$(info make distclean Cleans out all object and output files)
$(info make help Brings up this message)
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main_basic_concepts.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\carlsim\connection_monitor\connection_monitor.vcxproj">
<Project>{6b9e864c-a1b9-48ce-b88b-41ca17b4b1a9}</Project>
Expand All @@ -38,6 +35,9 @@
<Project>{5aa9a99d-3439-4c97-9949-c4c0ae5b855a}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\main_basic_concepts.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3B1E7EE9-B2EB-4D1A-97BD-86747AB439B5}</ProjectGuid>
<RootNamespace>random</RootNamespace>
Expand Down
133 changes: 103 additions & 30 deletions doc/source/tutorial/2_random_spnet/Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,107 @@
# Makefile for building Tutorial code from the CARLsim library

# NOTE: need to tell CARLsim where to find the user.mk
USER_MK_PATH = ../../../../
include $(USER_MK_PATH)user.mk

# list all targets in this directory
local_targets := random_spnet
output := *.dot *.dat *.log *.csv results/*

# we are compiling from carlsim lib
CARLSIM_FLAGS += -I$(CARLSIM_LIB_DIR)/include/kernel \
-I$(CARLSIM_LIB_DIR)/include/interface \
-I$(CARLSIM_LIB_DIR)/include/spike_monitor \
-I$(CARLSIM_LIB_DIR)/include/group_monitor \
-I$(CARLSIM_LIB_DIR)/include/connection_monitor \
-I$(CARLSIM_LIB_DIR)/include/spike_generators \
-I$(CARLSIM_LIB_DIR)/include/visual_stimulus \
-I$(CARLSIM_LIB_DIR)/include/simple_weight_tuner
CARLSIM_LIBS += -L$(CARLSIM_LIB_DIR)/lib -lCARLsim

.PHONY: all clean distclean
all: $(local_targets)
# compile from CARLsim lib

# list all rules, one per target
random_spnet: main_random_spnet.cpp
$(NVCC) $(CARLSIM_INCLUDES) $(CARLSIM_FLAGS) $(CARLSIM_LFLAGS) $< -o $@ $(CARLSIM_LIBS)
##----------------------------------------------------------------------------##
##
## CARLsim4 Project Makefile
## -------------------------
##
## Authors: Michael Beyeler <[email protected]>
## Kristofor Carlson <[email protected]>
##
## Institute: Cognitive Anteater Robotics Lab (CARL)
## Department of Cognitive Sciences
## University of California, Irvine
## Irvine, CA, 92697-5100, USA
##
## Version: 03/31/2016
##
##----------------------------------------------------------------------------##

################################################################################
# Start of user-modifiable section
################################################################################

# In this section, specify all files that are part of the project.

# Name of the binary file to be created.
# NOTE: There must be a corresponding .cpp file named main_$(proj_target).cpp!
proj_target := random_spnet

# Directory where all include files reside. The Makefile will automatically
# detect and include all .h files within that directory.
proj_inc_dir := inc

# Directory where all source files reside. The Makefile will automatically
# detect and include all .cpp and .cu files within that directory.
proj_src_dir := src

################################################################################
# End of user-modifiable section
################################################################################


#------------------------------------------------------------------------------
# Include configuration file
#------------------------------------------------------------------------------

# NOTE: If your CARLsim4 installation does not reside in the default path, make
# sure the environment variable CARLSIM4_INSTALL_DIR is set.
ifneq ($(CARLSIM4_INSTALL_DIR),)
CARLSIM4_INC_DIR := $(CARLSIM4_INSTALL_DIR)/inc
else
CARLSIM4_INC_DIR := /usr/local/include/carlsim
endif

# include compile flags etc.
include $(CARLSIM4_INC_DIR)/configure.mk


#------------------------------------------------------------------------------
# Build local variables
#------------------------------------------------------------------------------

main_src_file := $(proj_src_dir)/main_$(proj_target).cpp

# build list of all .cpp, .cu, and .h files (but don't include main_src_file)
cpp_files := $(wildcard $(proj_src_dir)/*.cpp)
cpp_files := $(filter-out $(main_src_file),$(cpp_files))
cu_files := $(wildcard $(proj_src_dir)/src/*.cu)
inc_files := $(wildcard $(proj_inc_dir)/*.h)

# compile .cpp files to -cpp.o, and .cu files to -cu.o
obj_files := $(patsubst %.cpp, %-cpp.o, $(cpp_files))
obj_files += $(patsubst %.cu, %-cu.o, $(cu_files))

# handled by clean and distclean
clean_files := $(obj_files) $(proj_target)
distclean_files := $(clean_files) results/* *.dot *.dat *.csv *.log


#------------------------------------------------------------------------------
# Project targets and rules
#------------------------------------------------------------------------------

.PHONY: $(proj_target) clean distclean help
default: $(proj_target)


$(proj_target): $(main_src_file) $(inc_files) $(cpp_files) $(obj_files)
$(NVCC) $(CARLSIM4_INC) $(CARLSIM4_LD) $(obj_files) $< -o $@

$(proj_src_dir)/%-cpp.o: $(proj_src_dir)/%.cpp $(inc_files)
$(CXX) -c $(CXXINCFL) $(CXXFL) $< -o $@

$(proj_src_dir)/%-cu.o: $(proj_src_dir)/%.cu $(inc_files)
$(NVCC) -c $(NVCCINCFL) $(SIMINCFL) $(NVCCFL) $< -o $@

clean:
$(RM) $(local_targets)
$(RM) $(clean_files)

distclean:
$(RM) $(local_targets) $(output)
$(RM) $(distclean_files)

help:
$(info CARLsim4 Test Suite options:)
$(info )
$(info make Compiles test suite
$(info make clean Cleans out all object files)
$(info make distclean Cleans out all object and output files)
$(info make help Brings up this message)
Loading