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 5 PKG_CONFIG ?= pkg-config 6 PKGS_FAKEGUDEV := gudev-1.0 glib-2.0 7 PKG_CFLAGS_FAKEGUDEV := $(shell ${PKG_CONFIG} --cflags $(PKGS_FAKEGUDEV)) 8 PKG_LIBS_FAKEGUDEV := $(shell ${PKG_CONFIG} --libs $(PKGS_FAKEGUDEV)) 9 PKGS_FAKESYSCALLS := glib-2.0 10 PKG_CFLAGS_FAKESYSCALLS := $(shell ${PKG_CONFIG} --cflags $(PKGS_FAKESYSCALLS)) 11 PKG_LIBS_FAKESYSCALLS := $(shell ${PKG_CONFIG} --libs $(PKGS_FAKESYSCALLS)) 12 WARN := -Werror -Wall 13 DEBUG := -g -DFAKE_G_UDEV_DEBUG -DFAKE_SYSCALLS_DEBUG 14 OPT := -O2 15 16 all: libfakegudev.so gudev-exercise libfakesyscalls.so fakesyscalls-exercise 17 .PHONY: clean all install 18 19 gudev-exercise: gudev-exercise.c 20 $(CC) -o $@ $(WARN) $(OPT) $(DEBUG) $(PKG_CFLAGS_FAKEGUDEV) \ 21 $< $(PKG_LIBS_FAKEGUDEV) 22 23 libfakegudev.so: fakegudev.c 24 $(CC) -fPIC -shared -o $@ $(WARN) $(OPT) $(DEBUG) \ 25 $(PKG_CFLAGS_FAKEGUDEV) $< -ldl 26 27 fakesyscalls-exercise: fakesyscalls-exercise.c 28 $(CC) -o $@ $(WARN) $(OPT) $(DEBUG) $(PKG_CFLAGS_FAKESYSCALLS) \ 29 $< $(PKG_LIBS_FAKESYSCALLS) 30 31 libfakesyscalls.so: fakesyscalls.c 32 $(CC) -fPIC -shared -o $@ $(WARN) $(OPT) $(DEBUG) \ 33 $(PKG_CFLAGS_FAKESYSCALLS) $< -ldl 34 35 install: 36 install -m 0755 -d $(DESTDIR)/lib 37 install -m 0755 libfakegudev.so $(DESTDIR)/lib 38 install -m 0755 libfakesyscalls.so $(DESTDIR)/lib 39 40 clean: 41 rm -f core gudev-exercise *.o *.so 42