Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: Makefile

Issue 3129002: Create a bootstat library for external C and C++ programs (Closed) Base URL: ssh://gitrw.chromium.org/bootstat.git
Patch Set: Fix whitespace issue found by presubmit check Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | README » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Makefile
diff --git a/Makefile b/Makefile
index 697875b087410267f5da801b8a375cc076f8c5b8..2066cdc085192a44498ddca7bb149107b6745538 100644
--- a/Makefile
+++ b/Makefile
@@ -5,19 +5,42 @@
# Makefile for bootstat utilities
#
-OPT_FLAGS = -O
-CFLAGS += -Wall -Werror -fPIC -fno-exceptions $(OPT_FLAGS)
+# OPT_CFLAGS is here to allow adding options for manual, host-side
+# builds.
+OPT_CFLAGS =
+CFLAGS += -Wall -Werror -fPIC -fno-exceptions $(OPT_CFLAGS)
-OBJS = \
- bootstat.o \
- bootstat_log.o
+LIB_OBJS = bootstat_log.o
+COMMAND_OBJS = bootstat.o
+COMMAND_LDFLAGS = $(LDFLAGS)
+
+TEST_OBJS = log_unit_tests.o
+TEST_LDFLAGS = $(LDFLAGS) -lgtest
+
+OBJS = $(LIB_OBJS) $(TEST_OBJS) $(COMMAND_OBJS)
+
+LIB = libbootstat.a
COMMAND = bootstat
+TEST = log_unit_test
+
+%.o: %.c
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+%.o: %.cc
+ $(CXX) $(CXXFLAGS) -o $@ -c $<
+
+all: $(COMMAND) $(LIB)
+tests: $(TEST)
+
+$(COMMAND): $(COMMAND_OBJS) $(LIB)
+ $(CC) -o $@ $(COMMAND_LDFLAGS) $^
-all: $(COMMAND)
+$(LIB): $(LIB_OBJS)
+ $(AR) rcs $@ $^
-$(COMMAND): $(OBJS)
- $(CC) -o $@ $(LDFLAGS) $(OBJS)
+$(TEST): $(TEST_OBJS) $(LIB)
+ $(CXX) $(TEST_LDFLAGS) -o $@ $^
clean:
- rm -f $(COMMAND) $(OBJS)
+ rm -f $(COMMAND) $(LIB) $(OBJS) $(TEST)
« no previous file with comments | « no previous file | README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698