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 PKGS := glib-2.0 dbus-glib-1 6 PKG_CONFIG ?= pkg-config 7 PKG_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKGS)) 8 PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKGS)) 9 10 CFLAGS ?= -O2 11 CFLAGS += $(PKG_CFLAGS) 12 CFLAGS += -g 13 WARN := -Werror -Wall 14 CFLAGS += $(WARN) 15 16 all: fakemodem fakenet 17 .PHONY: all clean install 18 19 fakemodem: fakemodem.c fakemodem-dbus.h 20 $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< $(PKG_LIBS) 21 22 fakemodem-dbus.h: fakemodem-dbus.xml 23 dbus-binding-tool --mode=glib-server --prefix=fakemodem \ 24 $< > $@.tmp 25 mv $@.tmp $@ 26 27 fakenet: fakenet.c 28 $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< 29 30 install: 31 install -m 0755 -d $(DESTDIR)/bin 32 install -m 0755 fakemodem fakenet $(DESTDIR)/bin 33 34 clean: 35 rm -f core fakemodem fakenet *.o *.so fakemodem-dbus.h 36