about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-11-02 16:58:14 -0500
committerRich Felker <dalias@aerifal.cx>2015-11-02 16:58:14 -0500
commit4cd8b4725907651f329e2f96d428c4e3521643f8 (patch)
tree71bb22474472eb7dccfc0399be08fd52eccdff6e /Makefile
parentfda365a53074f97f3213caefe70ea13297acecb2 (diff)
downloadmusl-4cd8b4725907651f329e2f96d428c4e3521643f8.tar.gz
musl-4cd8b4725907651f329e2f96d428c4e3521643f8.tar.xz
musl-4cd8b4725907651f329e2f96d428c4e3521643f8.zip
keep user-provided CFLAGS/LDFLAGS separate from those added by configure
this way, overriding these variables on the make command line (or just
re-passing the originally-passed values when invoking make) won't
suppress use of the flags added by configure.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 8 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b2226fad..2b210151 100644
--- a/Makefile
+++ b/Makefile
@@ -23,18 +23,22 @@ GENH = include/bits/alltypes.h
 GENH_INT = src/internal/version.h
 IMPH = src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h
 
-LDFLAGS = 
+LDFLAGS =
+LDFLAGS_AUTO =
 LIBCC = -lgcc
 CPPFLAGS =
-CFLAGS = -Os -pipe
+CFLAGS =
+CFLAGS_AUTO = -Os -pipe
 CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc 
 
 CFLAGS_ALL = $(CFLAGS_C99FSE)
 CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I./arch/$(ARCH) -I./src/internal -I./include
-CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS)
+CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
 CFLAGS_ALL_STATIC = $(CFLAGS_ALL)
 CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED
 
+LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
+
 AR      = $(CROSS_COMPILE)ar
 RANLIB  = $(CROSS_COMPILE)ranlib
 INSTALL = ./tools/install.sh
@@ -146,7 +150,7 @@ endif
 	$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
 
 lib/libc.so: $(LOBJS)
-	$(CC) $(CFLAGS_ALL_SHARED) $(LDFLAGS) -nostdlib -shared \
+	$(CC) $(CFLAGS_ALL_SHARED) $(LDFLAGS_ALL) -nostdlib -shared \
 	-Wl,-e,_dlstart -Wl,-Bsymbolic-functions \
 	-o $@ $(LOBJS) $(LIBCC)