blob: a290523eb60136feac41457eade849b1871332da [file] [log] [blame]
This fixes up makefiles so they work in the Chrome OS build
environment. In particular:
1. Add $(CPPFLAGS) to compiler invocations.
2. Replace bare ar invocation with $(AR) for cross compilation.
3. Add additional flags to silence warnings generated by clang.
4. Remove emptry call to STRIP.
--- a/Common/ConsoleIO/makefile
+++ b/Common/ConsoleIO/makefile
@@ -38,10 +38,10 @@
all: libconsoleio.a
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
libconsoleio.a: $(OBJFILES)
- ar $(ARFLAGS) $@ $^
+ $(AR) $(ARFLAGS) $@ $^
clean:
rm -rfv *.o libconsoleio.a
--- a/Common/Crypt/makefile
+++ b/Common/Crypt/makefile
@@ -38,10 +38,10 @@
all: libcrypt.a
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
libcrypt.a: $(OBJFILES)
- ar $(ARFLAGS) $@ $^
+ $(AR) $(ARFLAGS) $@ $^
clean:
rm -rfv *.o libcrypt.a
--- a/Common/FileIO/makefile
+++ b/Common/FileIO/makefile
@@ -37,10 +37,10 @@
all: libfileio.a
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
libfileio.a: $(OBJFILES)
- ar $(ARFLAGS) $@ $^
+ $(AR) $(ARFLAGS) $@ $^
clean:
rm -rfv *.o libfileio.a
--- a/Common/MicroTss/makefile
+++ b/Common/MicroTss/makefile
@@ -69,10 +69,10 @@
all: libmicrotss.a
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
libmicrotss.a: $(OBJFILES)
- ar $(ARFLAGS) $@ $^
+ $(AR) $(ARFLAGS) $@ $^
clean:
rm -rfv *.o libmicrotss.a
--- a/Common/Platform/makefile
+++ b/Common/Platform/makefile
@@ -36,10 +36,10 @@
all: libplatform.a
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
libplatform.a: $(OBJFILES)
- ar $(ARFLAGS) $@ $^
+ $(AR) $(ARFLAGS) $@ $^
clean:
rm -rfv *.o libplatform.a
--- a/Common/TpmDeviceAccess/makefile
+++ b/Common/TpmDeviceAccess/makefile
@@ -40,10 +40,10 @@
all: libtpmdeviceaccess.a
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
libtpmdeviceaccess.a: $(OBJFILES)
- ar $(ARFLAGS) $@ $^
+ $(AR) $(ARFLAGS) $@ $^
clean:
rm -rfv *.o libtpmdeviceaccess.a
--- a/TPMFactoryUpd/makefile
+++ b/TPMFactoryUpd/makefile
@@ -13,7 +13,6 @@
#
# The makefile uses the gcc compiler.
#
-STRIP=strip --strip-unneeded $@ # Don't strip if you want to debug
#FPACK+= -fpack-struct # Don't pack structs globally. This would crash OpenSSL decrypt operation
# Basic compiler options
@@ -29,13 +28,17 @@
-Wunreachable-code \
-DLINUX
-CC = gcc
+# Additional flags to make the source compile with clang.
+CFLAGS+= \
+ -Wno-newline-eof \
+ -Wno-gnu-zero-variadic-macro-arguments \
+ -Wno-cast-align
# Export compiler flags to sub-makefiles
export CFLAGS
export CC
-LDFLAGS=\
+LDFLAGS+=\
-lcrypt -L../Common/Crypt \
-lplatform -L../Common/Platform \
-lmicrotss -L../Common/MicroTss \
@@ -103,7 +106,7 @@
coverage: TPMFactoryUpd
$(OBJFILES): %.o: %.c
- $(CC) -c $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(FPACK) $(INCLUDES) $< -o $@
TPMFactoryUpd: $(OBJFILES)
# Call shared sub-makefiles to generate archives
@@ -114,8 +117,7 @@
$(MAKE) -C ../Common/TpmDeviceAccess
$(MAKE) -C ../Common/Crypt
# And run the actual makefile job
- $(CC) $^ -o $@ $(LDFLAGS)
- $(STRIP)
+ $(CC) $^ -o $@ $(CFLAGS) $(LDFLAGS)
clean:
# Call shared sub-makefiles to cleanup archives