Makefile 905 Bytes
Newer Older
Stefan Lankes's avatar
Stefan Lankes committed
1 2 3 4 5 6 7 8
MAKE = make
CC = gcc
CXX = g++
# optimzation flags
#CFLAGS = -Wall -O3
# flags for debugging
CFLAGS = -Wall -O0 -g -pthread
CXXFLAGS = $(CFLAGS)
Steffen Vogel's avatar
Steffen Vogel committed
9
LDFLAGS = -static
Stefan Lankes's avatar
Stefan Lankes committed
10 11
RM = rm -rf
ASM = nasm
12
ASMFLAGS = -f elf64 -O0 -g -F dwarf
Stefan Lankes's avatar
Stefan Lankes committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48

NAME = jacobi_v1
C_source = main.c init_matrix.c
CPP_source =
ASM_source =

# extend this for other object files
OBJS += $(patsubst %.cpp, %.o, $(filter %.cpp, $(CPP_source)))
OBJS += $(patsubst %.c, %.o, $(filter %.c, $(C_source)))
OBJS += $(patsubst %.asm, %.o, $(filter %.asm, $(ASM_source)))

# other implicit rules
%.o : %.c
	$(CC) -c $(CFLAGS) -o $@ $< 

%.o : %.cpp
	$(CXX) -c $(CXXFLAGS) -o $@ $<

%.o : %.asm
	$(ASM) $(ASMFLAGS) -o $@ $<

default:
	$(MAKE) $(NAME)

all:
	$(MAKE) $(NAME)

$(NAME): $(OBJS)
	$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LDFLAGS)

clean:
	$(RM) *.o $(NAME)

depend:
	$(CC) -MM $(CFLAGS) $(C_source) $(CPP_source) > Makefile.dep

Steffen Vogel's avatar
Steffen Vogel committed
49
-include Makefile.dep