1# Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5PKG_CONFIG ?= pkg-config 6PKGS_FAKEGUDEV := gudev-1.0 glib-2.0 7PKG_CFLAGS_FAKEGUDEV := $(shell ${PKG_CONFIG} --cflags $(PKGS_FAKEGUDEV)) 8PKG_LIBS_FAKEGUDEV := $(shell ${PKG_CONFIG} --libs $(PKGS_FAKEGUDEV)) 9PKGS_FAKESYSCALLS := glib-2.0 10PKG_CFLAGS_FAKESYSCALLS := $(shell ${PKG_CONFIG} --cflags $(PKGS_FAKESYSCALLS)) 11PKG_LIBS_FAKESYSCALLS := $(shell ${PKG_CONFIG} --libs $(PKGS_FAKESYSCALLS)) 12WARN := -Werror -Wall 13DEBUG := -g -DFAKE_G_UDEV_DEBUG -DFAKE_SYSCALLS_DEBUG 14OPT := -O2 15 16all: libfakegudev.so gudev-exercise libfakesyscalls.so fakesyscalls-exercise 17.PHONY: clean all install 18 19gudev-exercise: gudev-exercise.c 20 $(CC) -o $@ $(WARN) $(OPT) $(DEBUG) $(PKG_CFLAGS_FAKEGUDEV) \ 21 $< $(PKG_LIBS_FAKEGUDEV) 22 23libfakegudev.so: fakegudev.c 24 $(CC) -fPIC -shared -o $@ $(WARN) $(OPT) $(DEBUG) \ 25 $(PKG_CFLAGS_FAKEGUDEV) $< -ldl 26 27fakesyscalls-exercise: fakesyscalls-exercise.c 28 $(CC) -o $@ $(WARN) $(OPT) $(DEBUG) $(PKG_CFLAGS_FAKESYSCALLS) \ 29 $< $(PKG_LIBS_FAKESYSCALLS) 30 31libfakesyscalls.so: fakesyscalls.c 32 $(CC) -fPIC -shared -o $@ $(WARN) $(OPT) $(DEBUG) \ 33 $(PKG_CFLAGS_FAKESYSCALLS) $< -ldl 34 35install: 36 install -m 0755 -d $(DESTDIR)/lib 37 install -m 0755 libfakegudev.so $(DESTDIR)/lib 38 install -m 0755 libfakesyscalls.so $(DESTDIR)/lib 39 40clean: 41 rm -f core gudev-exercise *.o *.so 42