xref: /netbsd-src/external/gpl3/binutils/dist/gprofng/examples/mxv-pthreads/src/Makefile (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1#
2#   Copyright (C) 2021-2023 Free Software Foundation, Inc.
3#
4# This file is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; see the file COPYING3.  If not see
16# <http://www.gnu.org/licenses/>.
17
18CC       = gcc
19WARNINGS = -Wall -Werror=undef -Wstrict-prototypes
20OPT      = -g -O
21CFLAGS   = $(OPT) $(WARNINGS)
22LDFLAGS  =
23LIBS     = -lm -lpthread
24OBJDIR   = ../objects
25BINDIR   = ../bindir
26EXPDIR   = ../experiments
27
28EXE     = mxv-pthreads
29OBJECTS = $(OBJDIR)/main.o $(OBJDIR)/manage_data.o $(OBJDIR)/workload.o $(OBJDIR)/mxv.o
30
31default: $(BINDIR)/$(EXE)
32
33$(BINDIR)/$(EXE): $(OBJECTS)
34	@mkdir -p $(BINDIR)
35	$(CC) -o $(BINDIR)/$(EXE) $(LDFLAGS) $(OBJECTS) $(LIBS)
36	ldd $(BINDIR)/$(EXE)
37
38$(OBJDIR)/main.o: main.c
39	@mkdir -p $(OBJDIR)
40	$(CC) -o $(OBJDIR)/main.o -c $(CFLAGS) main.c
41$(OBJDIR)/manage_data.o: manage_data.c
42	@mkdir -p $(OBJDIR)
43	$(CC) -o $(OBJDIR)/manage_data.o -c $(CFLAGS) manage_data.c
44$(OBJDIR)/workload.o: workload.c
45	@mkdir -p $(OBJDIR)
46	$(CC) -o $(OBJDIR)/workload.o -c $(CFLAGS) workload.c
47$(OBJDIR)/mxv.o: mxv.c
48	@mkdir -p $(OBJDIR)
49	$(CC) -o $(OBJDIR)/mxv.o -c $(CFLAGS) mxv.c
50
51$(OBJECTS): mydefs.h
52
53.c.o:
54	$(CC) -c -o $@ $(CFLAGS) $<
55
56check:
57	@echo "Running $(EXE) in $(EXPDIR)"
58	@./$(EXPDIR)/$(EXE) -m 1000 -n 1500 -t 2
59
60install: $(BINDIR)/$(EXE)
61	@/bin/cp $(BINDIR)/$(EXE) $(EXPDIR)
62	@echo "Installed $(EXE) in $(EXPDIR)"
63
64clean:
65	@/bin/rm -f $(BINDIR)/$(EXE)
66	@/bin/rm -f $(OBJECTS)
67
68veryclean:
69	@make clean
70	@/bin/rm -f $(EXPDIR)/$(EXE)
71