| # Copyright 2011 Google Inc. All Rights Reserved. |
| # Author: dgentry@google.com (Denton Gentry) |
| |
| CROSS_PREFIX:=$(TARGET) |
| CC:=$(CROSS_PREFIX)gcc |
| CPP:=$(CROSS_PREFIX)g++ |
| LD:=$(CROSS_PREFIX)ld |
| AR:=$(CROSS_PREFIX)ar |
| RANLIB:=$(CROSS_PREFIX)ranlib |
| STRIP:=$(CROSS_PREFIX)strip |
| |
| CFLAGS = -g -Os -Wall -Werror -I. |
| |
| SRCS = hmx_upgrade_flash.c hmx_upgrade_nvram.c |
| INCS = hmx_upgrade_nvram.h hnvram_dlist.h |
| OBJS = $(SRCS:.c=.o) |
| |
| all: libhmxupgrade.a |
| |
| .c.o: |
| $(CC) $(CFLAGS) -c $< -o $@ |
| |
| unit_test: test |
| test: hmx_upgrade_flash_test hmx_upgrade_nvram_test |
| ./test/hmx_upgrade_flash_test |
| ./test/hmx_upgrade_nvram_test |
| |
| libhmxupgrade.a: $(OBJS) $(INCS) |
| $(AR) rcs $@ $(OBJS) |
| |
| hmx_upgrade_flash_test: |
| $(CPP) $(CFLAGS) ./test/hmx_upgrade_flash_test.cc hmx_upgrade_flash.c -o ./test/$@ -lgtest -lpthread |
| |
| hmx_upgrade_nvram_test: |
| $(CPP) $(CFLAGS) -std=gnu++11 ./test/hmx_upgrade_nvram_test.cc -o ./test/$@ -lgtest -lpthread |
| |
| clean: |
| rm -f ./test/hmx_upgrade_nvram_test ./test/hmx_upgrade_flash_test libhmxupgrade.a *.o |