Update makefiles
This commit is contained in:
@@ -22,6 +22,6 @@ set(SOURCE_FILES
|
||||
src/branch_and_cut.h
|
||||
src/branch_and_cut.c)
|
||||
|
||||
add_executable(project ${SOURCE_FILES} )
|
||||
add_executable(project ${SOURCE_FILES} src/gtsp.h src/gtsp.c src/geometry.h src/geometry.c)
|
||||
|
||||
target_link_libraries(project cplex m pthread)
|
||||
34
Makefile.linux
Normal file
34
Makefile.linux
Normal file
@@ -0,0 +1,34 @@
|
||||
path := src/*/*.c src/*.c src/*.s
|
||||
include:= src/*.h
|
||||
binary := bin/hw2.run
|
||||
|
||||
source := $(wildcard ${path})
|
||||
headers:= $(wildcard ${include})
|
||||
obj := $(patsubst src/%, bin/%, $(patsubst %.c,%.o, $(patsubst %.s,%.s.o, $(source))))
|
||||
|
||||
CPLEX_INCLUDE = /opt/cplex-12.4/distribution/cplex/include/ilcplex
|
||||
|
||||
flags := -O3 -g -Wall -pedantic -g --std=c11 -Winline -I$(CPLEX_INCLUDE)
|
||||
libs := -lcplex -lm -lpthread
|
||||
|
||||
compile: $(obj) $(binary)
|
||||
|
||||
run: compile
|
||||
@$(binary)
|
||||
|
||||
bin/%.s.o: src/%.s
|
||||
@echo ' as $<'
|
||||
@$(AS) $< -o $@
|
||||
|
||||
bin/%.o: src/%.c $(headers)
|
||||
@mkdir -p bin
|
||||
@echo ' cc $<'
|
||||
@$(CC) -c $(flags) $< -o $@
|
||||
|
||||
$(binary): $(obj)
|
||||
@mkdir -p bin
|
||||
@echo ' ld $@'
|
||||
@$(CC) $(flags) $(obj) $(libs) -o $@
|
||||
|
||||
clean:
|
||||
@$(RM) -f $(obj) $(binary)
|
||||
36
Makefile.windows
Normal file
36
Makefile.windows
Normal file
@@ -0,0 +1,36 @@
|
||||
path := src/*/*.c src/*.c src/*.s
|
||||
include:= src/*.h
|
||||
binary := bin/hw2.exe
|
||||
|
||||
source := $(wildcard ${path})
|
||||
headers:= $(wildcard ${include})
|
||||
obj := $(patsubst src/%, bin/%, $(patsubst %.c,%.o, $(patsubst %.s,%.s.o, $(source))))
|
||||
|
||||
CPLEX_INCLUDE = /cygdrive/c/Program\ Files/IBM/ILOG/CPLEX_Studio1261/cplex/include/ilcplex
|
||||
CPLEX_LIB = /cygdrive/c/Program\ Files/IBM/ILOG/CPLEX_Studio1261/cplex/bin/x64_win64
|
||||
|
||||
flags := -O3 -g -Wall -pedantic -g --std=c11 -Winline -I$(CPLEX_INCLUDE)
|
||||
libs := -L$(CPLEX_LIB) -lcplex1261 -lm -lpthread
|
||||
|
||||
compile: $(obj) $(binary)
|
||||
|
||||
run: compile
|
||||
@$(binary)
|
||||
|
||||
bin/%.s.o: src/%.s
|
||||
@echo ' as $<'
|
||||
@$(AS) $< -o $@
|
||||
|
||||
bin/%.o: src/%.c $(headers)
|
||||
@mkdir -p bin
|
||||
@echo ' cc $<'
|
||||
@$(CC) -c $(flags) $< -o $@
|
||||
|
||||
$(binary): $(obj)
|
||||
@mkdir -p bin
|
||||
@echo ' ld $@'
|
||||
@$(CC) $(flags) $(obj) $(libs) -o $@
|
||||
|
||||
clean:
|
||||
@$(RM) -f $(obj) $(binary)
|
||||
|
||||
Reference in New Issue
Block a user