blob: 708515f0493bd612806730eb5ea1d336fd3ade32 [file] [log] [blame]
Peter Stugedad1e302008-11-22 17:13:36 +00001# Makefile for msrtool
2#
3# This file is part of msrtool.
4#
5# Copyright (c) 2008 Peter Stuge <peter@stuge.se>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
Peter Stugedad1e302008-11-22 17:13:36 +000016
17PROGRAM = msrtool
18
19CC = @CC@
20INSTALL = @INSTALL@
21PREFIX = @PREFIX@
Anton Kochkov7c634ae2011-06-20 23:14:22 +040022CFLAGS = @CFLAGS@ -fno-pic
Peter Stugedad1e302008-11-22 17:13:36 +000023LDFLAGS = @LDFLAGS@
24
Olivier Langloisccc7d1f2013-06-03 01:30:25 -040025TARGETS = geodegx2.o geodelx.o cs5536.o k8.o intel_pentium3_early.o intel_pentium3.o intel_pentium4_early.o intel_pentium4_later.o intel_core1.o intel_core2_early.o intel_core2_later.o intel_nehalem.o intel_atom.o
Andriy Gapond80e57c2009-11-28 05:21:42 +000026SYSTEMS = linux.o darwin.o freebsd.o
Peter Stugedad1e302008-11-22 17:13:36 +000027OBJS = $(PROGRAM).o msrutils.o sys.o $(SYSTEMS) $(TARGETS)
28
29all: $(PROGRAM)
30
31$(PROGRAM): $(OBJS) Makefile.deps
32 $(CC) -o $@ $(OBJS) $(LDFLAGS)
33
34$(PROGRAM).o: $(PROGRAM).c
35 $(CC) $(CFLAGS) -DVERSION='"@VERSION@"' -c $< -o $@
36
37install: $(PROGRAM)
Stefan Reinauer37f39352009-09-01 10:03:01 +000038 mkdir -p $(DESTDIR)$(PREFIX)/sbin
39 $(INSTALL) $(PROGRAM) $(DESTDIR)$(PREFIX)/sbin
Peter Stugedad1e302008-11-22 17:13:36 +000040
41distprep: distclean Makefile.deps
42
43clean:
44 rm -f $(PROGRAM) $(OBJS)
45
46distclean: clean
47 rm -f Makefile
48
49mrproper: distclean
50 rm -f Makefile.deps
51
52dep:
53 rm -f Makefile.deps
54 $(MAKE) Makefile.deps
55
56Makefile.deps: $(patsubst %.o,%.c,$(OBJS))
57 $(CC) -MM $^ > $@
58
59.PHONY: all distprep clean distclean mrproper dep
60
61-include Makefile.deps