Skip to content

Commit

Permalink
rearrange all top makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
limbo018 committed Jan 14, 2017
1 parent 79b183a commit a69280a
Show file tree
Hide file tree
Showing 18 changed files with 247 additions and 115 deletions.
2 changes: 1 addition & 1 deletion Include.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# determine linking flags
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S), Linux)
LINK_FLAG = -static # overall linking flag, maybe changed later
LINK_FLAG = # overall linking flag, maybe changed later
STATIC_LINK_FLAG = -Wl,-Bstatic # ld under Linux has fine control
DYNAMIC_LINK_FLAG = -Wl,-Bdynamic # ld under Linux has fine control
endif
Expand Down
99 changes: 14 additions & 85 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,94 +1,23 @@
# top makefile

MAKE = make
TEST_DIR = test

# list of components
PARSERS = limbo/parsers
SOLVERS = limbo/solvers
PROGRAMOPTIONS = limbo/programoptions
THIRDPARTY = limbo/thirdparty
all: limbo

RESRCS = \
$(PARSERS)/def/bison \
$(PARSERS)/lef/bison \
$(PARSERS)/ebeam/bison \
$(PARSERS)/lp/bison \
$(PARSERS)/verilog/bison \
$(PARSERS)/gdf/bison \
$(PARSERS)/gdsii/stream \
$(PARSERS)/bookshelf/bison \
$(SOLVERS)/lpmcf \
$(PROGRAMOPTIONS)

.PHONY: build

build:
mkdir -p lib
mkdir -p bin
$(MAKE) -C $(PARSERS)/def/bison
$(MAKE) all -C $(PARSERS)/lef/bison
$(MAKE) -C $(PARSERS)/ebeam/bison
$(MAKE) -C $(PARSERS)/lp/bison
$(MAKE) -C $(PARSERS)/verilog/bison
$(MAKE) -C $(PARSERS)/gdf/bison
$(MAKE) -C $(PARSERS)/gdsii/stream
$(MAKE) -C $(PARSERS)/bookshelf/bison
$(MAKE) -C $(PROGRAMOPTIONS)
$(MAKE) -C $(THIRDPARTY)

install:
mkdir -p lib
mkdir -p bin
$(MAKE) install -C $(PARSERS)/def/bison
$(MAKE) install -C $(PARSERS)/lef/bison
$(MAKE) install -C $(PARSERS)/ebeam/bison
$(MAKE) install -C $(PARSERS)/lp/bison
$(MAKE) install -C $(PARSERS)/verilog/bison
$(MAKE) install -C $(PARSERS)/gdf/bison
$(MAKE) install -C $(PARSERS)/gdsii/stream
$(MAKE) install -C $(PARSERS)/bookshelf/bison
$(MAKE) install -C $(PROGRAMOPTIONS)
$(MAKE) install -C $(THIRDPARTY)
.PHONY: limbo
limbo:
$(MAKE) -C limbo

.PHONY: test
test:
$(MAKE) -C $(TEST_DIR)/algorithms
$(MAKE) -C $(TEST_DIR)/geometry
$(MAKE) -C $(TEST_DIR)/parsers/def
$(MAKE) -C $(TEST_DIR)/parsers/lef
$(MAKE) -C $(TEST_DIR)/parsers/ebeam
$(MAKE) -C $(TEST_DIR)/parsers/lp
$(MAKE) -C $(TEST_DIR)/parsers/tf
$(MAKE) -C $(TEST_DIR)/parsers/verilog
$(MAKE) -C $(TEST_DIR)/parsers/gdf
$(MAKE) -C $(TEST_DIR)/parsers/gdsii
$(MAKE) -C $(TEST_DIR)/parsers/bookshelf
$(MAKE) -C $(TEST_DIR)/programoptions
$(MAKE) -C $(TEST_DIR)/solvers/lpmcf
$(MAKE) -C $(TEST_DIR)/string
$(MAKE) -C test

.PHONY: clean
clean:
$(MAKE) extraclean -C $(PARSERS)/def/bison
$(MAKE) extraclean -C $(PARSERS)/lef/bison
$(MAKE) extraclean -C $(PARSERS)/ebeam/bison
$(MAKE) extraclean -C $(PARSERS)/lp/bison
$(MAKE) extraclean -C $(PARSERS)/verilog/bison
$(MAKE) extraclean -C $(PARSERS)/gdf/bison
$(MAKE) extraclean -C $(PARSERS)/gdsii/stream
$(MAKE) extraclean -C $(PARSERS)/bookshelf/bison
$(MAKE) extraclean -C $(PROGRAMOPTIONS)
$(MAKE) extraclean -C $(THIRDPARTY)
$(MAKE) extraclean -C $(TEST_DIR)/algorithms
$(MAKE) extraclean -C $(TEST_DIR)/geometry
$(MAKE) extraclean -C $(TEST_DIR)/parsers/def
$(MAKE) extraclean -C $(TEST_DIR)/parsers/lef
$(MAKE) extraclean -C $(TEST_DIR)/parsers/ebeam
$(MAKE) extraclean -C $(TEST_DIR)/parsers/lp
$(MAKE) extraclean -C $(TEST_DIR)/parsers/tf
$(MAKE) extraclean -C $(TEST_DIR)/parsers/verilog
$(MAKE) extraclean -C $(TEST_DIR)/parsers/gdf
$(MAKE) extraclean -C $(TEST_DIR)/parsers/gdsii
$(MAKE) extraclean -C $(TEST_DIR)/parsers/bookshelf
$(MAKE) extraclean -C $(TEST_DIR)/programoptions
$(MAKE) extraclean -C $(TEST_DIR)/solvers/lpmcf
$(MAKE) extraclean -C $(TEST_DIR)/string
$(MAKE) clean -C limbo
$(MAKE) clean -C test

.PHONY: extraclean
extraclean:
$(MAKE) extraclean -C limbo
$(MAKE) extraclean -C test
17 changes: 9 additions & 8 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ Users need to make sure they are properly installed and the corresponding settin

* In the directory of limbo library, run
```
make install
make
make test (optional)
```
After installation, it is strongly recommended to export LIMBO_DIR to the path where Limbo library is installed as an environment variable.

Expand All @@ -118,8 +119,8 @@ After installation, it is strongly recommended to export LIMBO_DIR to the path w
* CXX sets the compiler for C++ and CC sets the compiler for C. FC sets the fortran compiler which is only needed by some third party packages like OpenBLAS.
Some examples are as follows,
```
make install CXX=g++ CC=gcc FC=gfortran (default for Linux)
make install CXX=clang++ CC=clang FC=gfortran (default for Mac/Darwin)
make CXX=g++ CC=gcc FC=gfortran (default for Linux)
make CXX=clang++ CC=clang FC=gfortran (default for Mac/Darwin)
```

### 3. Customize CXXSTDLIB and CXXSTD options
Expand All @@ -128,15 +129,15 @@ make install CXX=clang++ CC=clang FC=gfortran (default for Mac/Darwin)

Under clang, following combinations are valid,
```
make install CXXSTDLIB="-stdlib=libstdc++" CXXSTD="-std=c++98" (default)
make install CXXSTDLIB="-stdlib=libc++" CXXSTD="-std=c++98"
make install CXXSTDLIB="-stdlib=libc++" CXXSTD="-std=c++11"
make CXXSTDLIB="-stdlib=libstdc++" CXXSTD="-std=c++98" (default)
make CXXSTDLIB="-stdlib=libc++" CXXSTD="-std=c++98"
make CXXSTDLIB="-stdlib=libc++" CXXSTD="-std=c++11"
```

Under gcc, there is no -stdlib option, so following combinations are valid,
```
make install CXXSTD="-std=c++98" (default)
make install CXXSTD="-std=c++11"
make CXXSTD="-std=c++98" (default)
make CXXSTD="-std=c++11"
```

Users must make sure the setting is consistent to dependent libraries during compilation, such as Boost, Lemon, etc.
Expand Down
28 changes: 28 additions & 0 deletions limbo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
all: geometry parsers programoptions thirdparty
.PHONY: geometry parsers programoptions thirdparty

geometry:
$(MAKE) -C geometry

parsers:
$(MAKE) -C parsers

programoptions:
$(MAKE) -C programoptions

thirdparty:
$(MAKE) -C thirdparty

.PHONY: clean
clean:
$(MAKE) clean -C geometry
$(MAKE) clean -C parsers
$(MAKE) clean -C programoptions
$(MAKE) clean -C thirdparty

.PHONY: extraclean
extraclean:
$(MAKE) extraclean -C geometry
$(MAKE) extraclean -C parsers
$(MAKE) extraclean -C programoptions
$(MAKE) extraclean -C thirdparty
50 changes: 50 additions & 0 deletions limbo/parsers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
all: bookshelf def ebeam gdf gdsii lef lp tf verilog
.PHONY: bookshelf def ebeam gdf gdsii lef lp tf verilog

bookshelf:
$(MAKE) -C bookshelf/bison

def:
$(MAKE) -C def/bison

ebeam:
$(MAKE) -C ebeam/bison

gdf:
$(MAKE) -C gdf/bison

gdsii:
$(MAKE) -C gdsii/stream

lef:
$(MAKE) -C lef/bison

lp:
$(MAKE) -C lp/bison

tf:

verilog:
$(MAKE) -C verilog/bison

.PHONY: clean
clean:
$(MAKE) clean -C bookshelf/bison
$(MAKE) clean -C def/bison
$(MAKE) clean -C ebeam/bison
$(MAKE) clean -C gdf/bison
$(MAKE) clean -C gdsii/stream
$(MAKE) clean -C lef/bison
$(MAKE) clean -C lp/bison
$(MAKE) clean -C verilog/bison

.PHONY: extraclean
extraclean:
$(MAKE) extraclean -C bookshelf/bison
$(MAKE) extraclean -C def/bison
$(MAKE) extraclean -C ebeam/bison
$(MAKE) extraclean -C gdf/bison
$(MAKE) extraclean -C gdsii/stream
$(MAKE) extraclean -C lef/bison
$(MAKE) extraclean -C lp/bison
$(MAKE) extraclean -C verilog/bison
39 changes: 23 additions & 16 deletions limbo/thirdparty/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ CSDP_SRCS = Csdp
OPENBLAS_SRCS = OpenBLAS
LIBLINEAR_SRCS = liblinear
CTHREADPOOL_SRCS = CThreadPool
DLX_SRCS = dlx

CSDP_LIB = $(LIMBO_ROOT_DIR)/lib/libsdp.a
OPENBLAS_LIB = $(LIMBO_ROOT_DIR)/lib/libopenblas-st.a
LIBLINEAR_LIB = $(LIMBO_ROOT_DIR)/lib/liblinear.a
CTHREADPOOL_LIB = $(LIMBO_ROOT_DIR)/lib/libthpool.a
DLX_LIB = $(LIMBO_ROOT_DIR)/lib/libdlx.a

#==========================================================================
# Compilation Flags
Expand All @@ -36,55 +39,59 @@ endif
# ==========================================================================

ifeq ($(OPENBLAS), 1)
all: $(CSDP_LIB) $(OPENBLAS_LIB) $(LIBLINEAR_LIB) $(CTHREADPOOL_LIB)
all: $(CSDP_LIB) $(OPENBLAS_LIB) $(LIBLINEAR_LIB) $(CTHREADPOOL_LIB) $(DLX_LIB)
@echo ">> building default with OPENBLAS on"
else
all: $(CTHREADPOOL_LIB)
all: $(CTHREADPOOL_LIB) $(DLX_LIB)
@echo ">> building default with OPENBLAS off"
endif

.PHONY: $(OPENBLAS_LIB) $(CSDP_LIB) $(LIBLINEAR_LIB) $(CTHREADPOOL_LIB) $(DLX_LIB)

$(OPENBLAS_LIB):
@echo ">> building OpenBLAS"
@make -C $(OPENBLAS_SRCS) -f Makefile.limbo
$(MAKE) -C $(OPENBLAS_SRCS) -f Makefile.limbo
mv $(OPENBLAS_SRCS)/OpenBLAS/libopenblas_*.a $(OPENBLAS_LIB) # the name may vary from architectures

$(CSDP_LIB): $(OPENBLAS_LIB)
@echo ">> building Csdp"
@make -C $(CSDP_SRCS)
$(MAKE) -C $(CSDP_SRCS)
mv $(CSDP_SRCS)/lib/libsdp.a $(CSDP_LIB)
mv $(CSDP_SRCS)/solver/csdp $(LIMBO_ROOT_DIR)/bin

$(LIBLINEAR_LIB): $(OPENBLAS_LIB)
@echo ">> building liblinear"
@make -C $(LIBLINEAR_SRCS)
$(MAKE) -C $(LIBLINEAR_SRCS)
mv $(LIBLINEAR_SRCS)/liblinear.a $(LIBLINEAR_LIB)
mv $(LIBLINEAR_SRCS)/train $(LIMBO_ROOT_DIR)/bin/liblinear-train
mv $(LIBLINEAR_SRCS)/predict $(LIMBO_ROOT_DIR)/bin/liblinear-predict

$(CTHREADPOOL_LIB):
@echo ">> build CThreadPool"
@make -C $(CTHREADPOOL_SRCS)
$(MAKE) -C $(CTHREADPOOL_SRCS)

$(DLX_LIB):
@echo ">> build dlx"
$(MAKE) -C $(DLX_SRCS)

install: $(OPENBLAS_LIB) $(CSDP_LIB) $(LIBLINEAR_LIB) $(CTHREADPOOL_LIB) clean
install: $(OPENBLAS_LIB) $(CSDP_LIB) $(LIBLINEAR_LIB) $(CTHREADPOOL_LIB) $(DLX_LIB) clean
@echo ">> building install"

.PHONY: clean
clean:
make -C $(OPENBLAS_SRCS) clean
make -C $(CSDP_SRCS) clean
make -C $(LIBLINEAR_SRCS) clean
make -C $(CTHREADPOOL_SRCS) clean
$(MAKE) -C $(OPENBLAS_SRCS) clean -f Makefile.limbo
$(MAKE) -C $(CSDP_SRCS) clean
$(MAKE) -C $(LIBLINEAR_SRCS) clean
$(MAKE) -C $(CTHREADPOOL_SRCS) clean
$(MAKE) -C $(DLX_SRCS) clean

.PHONY: extraclean
extraclean:
make -C $(OPENBLAS_SRCS) clean -f Makefile.limbo
extraclean: clean
rm -f $(OPENBLAS_LIB)
make -C $(CSDP_SRCS) clean
rm -f $(CSDP_LIB)
rm -f $(LIMBO_ROOT_DIR)/bin/csdp
make -C $(LIBLINEAR_SRCS) clean
rm -f $(LIBLINEAR_LIB)
rm -f $(LIMBO_ROOT_DIR)/bin/liblinear-train
rm -f $(LIMBO_ROOT_DIR)/bin/liblinear-predict
make -C $(CTHREADPOOL_SRCS) clean
rm -f $(CTHREADPOOL_LIB)
rm -f $(DLX_LIB)
2 changes: 1 addition & 1 deletion limbo/thirdparty/OpenBLAS/Makefile.limbo
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ endif

.PHONY: clean
clean:
@make -f Makefile clean
$(MAKE) -C OpenBLAS -f Makefile clean
39 changes: 39 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
all: algorithms geometry parsers programoptions solvers string

.PHONY: algorithms geometry parsers programoptions solvers string

algorithms:
$(MAKE) -C algorithms

geometry:
$(MAKE) -C geometry

parsers:
$(MAKE) -C parsers

programoptions:
$(MAKE) -C programoptions

solvers:
$(MAKE) -C solvers

string:
$(MAKE) -C string

.PHONY: clean
clean:
$(MAKE) clean -C algorithms
$(MAKE) clean -C geometry
$(MAKE) clean -C parsers
$(MAKE) clean -C programoptions
$(MAKE) clean -C solvers
$(MAKE) clean -C string

.PHONY: extraclean
extraclean:
$(MAKE) extraclean -C algorithms
$(MAKE) extraclean -C geometry
$(MAKE) extraclean -C parsers
$(MAKE) extraclean -C programoptions
$(MAKE) extraclean -C solvers
$(MAKE) extraclean -C string
4 changes: 4 additions & 0 deletions test/algorithms/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,7 @@ clean: cleandep
.PHONY: cleandep
cleandep:
rm -f $(DEPS)

.PHONY: extraclean
extraclean: clean
rm -rf $(OBJDIR)
1 change: 1 addition & 0 deletions test/geometry/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,4 @@ cleandep:

.PHONY: extraclean
extraclean: clean
rm -rf $(OBJDIR)
Loading

0 comments on commit a69280a

Please sign in to comment.