You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
737 B
35 lines
737 B
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)
|