Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | # |
| 2 | # Makefile for musl (requires GNU make) |
| 3 | # |
| 4 | # This is how simple every makefile should be... |
| 5 | # No, I take that back - actually most should be less than half this size. |
| 6 | # |
| 7 | # Use config.mak to override any of the following variables. |
| 8 | # Do not make changes here. |
| 9 | # |
| 10 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 11 | srcdir = . |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 12 | exec_prefix = /usr/local |
| 13 | bindir = $(exec_prefix)/bin |
| 14 | |
| 15 | prefix = /usr/local/musl |
| 16 | includedir = $(prefix)/include |
| 17 | libdir = $(prefix)/lib |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 18 | syslibdir = /lib |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 19 | |
Rich Felker | b6363bb | 2016-01-20 02:31:06 +0000 | [diff] [blame] | 20 | BASE_SRCS = $(sort $(wildcard $(srcdir)/src/*/*.c $(srcdir)/arch/$(ARCH)/src/*.[csS])) |
Rich Felker | 9f5eb77 | 2016-01-19 18:19:01 -0500 | [diff] [blame] | 21 | BASE_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(BASE_SRCS))) |
Rich Felker | 0f814a4 | 2016-01-20 02:49:32 +0000 | [diff] [blame] | 22 | ARCH_SRCS = $(wildcard $(srcdir)/src/*/$(ARCH)/*.[csS]) |
Rich Felker | 9f5eb77 | 2016-01-19 18:19:01 -0500 | [diff] [blame] | 23 | ARCH_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS))) |
Rich Felker | 0f814a4 | 2016-01-20 02:49:32 +0000 | [diff] [blame] | 24 | REPLACED_OBJS = $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS))) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 25 | OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort $(BASE_OBJS) $(ARCH_OBJS)))) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 26 | LOBJS = $(OBJS:.o=.lo) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 27 | GENH = obj/include/bits/alltypes.h |
| 28 | GENH_INT = obj/src/internal/version.h |
| 29 | IMPH = $(addprefix $(srcdir)/, src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 30 | |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 31 | LDFLAGS = |
| 32 | LDFLAGS_AUTO = |
Rich Felker | 1b23145 | 2012-08-02 21:05:43 -0400 | [diff] [blame] | 33 | LIBCC = -lgcc |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 34 | CPPFLAGS = |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 35 | CFLAGS = |
| 36 | CFLAGS_AUTO = -Os -pipe |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 37 | CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc |
| 38 | |
| 39 | CFLAGS_ALL = $(CFLAGS_C99FSE) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 40 | CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -Iobj/src/internal -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 41 | CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS) |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 42 | |
Rich Felker | 4cd8b47 | 2015-11-02 16:58:14 -0500 | [diff] [blame] | 43 | LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS) |
| 44 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 45 | AR = $(CROSS_COMPILE)ar |
| 46 | RANLIB = $(CROSS_COMPILE)ranlib |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 47 | INSTALL = $(srcdir)/tools/install.sh |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 48 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 49 | ARCH_INCLUDES = $(wildcard $(srcdir)/arch/$(ARCH)/bits/*.h) |
| 50 | INCLUDES = $(wildcard $(srcdir)/include/*.h $(srcdir)/include/*/*.h) |
| 51 | ALL_INCLUDES = $(sort $(INCLUDES:$(srcdir)/%=%) $(GENH:obj/%=%) $(ARCH_INCLUDES:$(srcdir)/arch/$(ARCH)/%=include/%)) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 52 | |
Rich Felker | 41d5183 | 2011-02-24 16:37:21 -0500 | [diff] [blame] | 53 | EMPTY_LIB_NAMES = m rt pthread crypt util xnet resolv dl |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 54 | EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a) |
Rich Felker | dc031ee | 2015-05-26 03:37:41 -0400 | [diff] [blame] | 55 | CRT_LIBS = lib/crt1.o lib/Scrt1.o lib/rcrt1.o lib/crti.o lib/crtn.o |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 56 | STATIC_LIBS = lib/libc.a |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 57 | SHARED_LIBS = lib/libc.so |
Rich Felker | 58f430c | 2012-04-22 14:32:49 -0400 | [diff] [blame] | 58 | TOOL_LIBS = lib/musl-gcc.specs |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 59 | ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 60 | ALL_TOOLS = obj/musl-gcc |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 61 | |
Shiz | b3cd7d1 | 2015-06-28 23:08:19 +0200 | [diff] [blame] | 62 | WRAPCC_GCC = gcc |
Shiz | fb58545 | 2015-06-28 23:08:21 +0200 | [diff] [blame] | 63 | WRAPCC_CLANG = clang |
Shiz | b3cd7d1 | 2015-06-28 23:08:19 +0200 | [diff] [blame] | 64 | |
Rich Felker | 3e7f186 | 2013-07-18 20:30:58 -0400 | [diff] [blame] | 65 | LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH)$(SUBARCH).so.1 |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 66 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 67 | -include config.mak |
| 68 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 69 | ifeq ($(ARCH),) |
| 70 | $(error Please set ARCH in config.mak before running make.) |
| 71 | endif |
| 72 | |
Rich Felker | 8d54681 | 2011-06-28 08:27:38 -0400 | [diff] [blame] | 73 | all: $(ALL_LIBS) $(ALL_TOOLS) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 74 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 75 | OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(OBJS) $(GENH) $(GENH_INT))) $(addprefix obj/, crt crt/$(ARCH) include)) |
| 76 | |
| 77 | $(ALL_LIBS) $(ALL_TOOLS) $(CRT_LIBS:lib/%=obj/crt/%) $(OBJS) $(LOBJS) $(GENH) $(GENH_INT): | $(OBJ_DIRS) |
| 78 | |
| 79 | $(OBJ_DIRS): |
| 80 | mkdir -p $@ |
| 81 | |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 82 | install: install-libs install-headers install-tools |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 83 | |
| 84 | clean: |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 85 | rm -f obj/crt/*.o obj/crt/$(ARCH)/*.o |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 86 | rm -f $(OBJS) |
| 87 | rm -f $(LOBJS) |
Rich Felker | 127ab57 | 2011-02-17 17:57:26 -0500 | [diff] [blame] | 88 | rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 89 | rm -f $(ALL_TOOLS) |
Rich Felker | 179ab5a | 2013-12-01 17:27:25 -0500 | [diff] [blame] | 90 | rm -f $(GENH) $(GENH_INT) |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 91 | rm -f obj/include/bits/alltypes.h |
Rich Felker | 1355fdc | 2011-02-15 00:33:23 -0500 | [diff] [blame] | 92 | |
Rich Felker | d76eafc | 2012-05-01 19:30:03 -0400 | [diff] [blame] | 93 | distclean: clean |
| 94 | rm -f config.mak |
| 95 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 96 | obj/include/bits/alltypes.h: $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in $(srcdir)/tools/mkalltypes.sed |
| 97 | sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in > $@ |
Rich Felker | 1355fdc | 2011-02-15 00:33:23 -0500 | [diff] [blame] | 98 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 99 | obj/src/internal/version.h: $(wildcard $(srcdir)/VERSION $(srcdir)/.git) |
| 100 | printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 101 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 102 | obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version.h |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 103 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 104 | obj/crt/rcrt1.o obj/src/ldso/dlstart.lo obj/src/ldso/dynlink.lo: $(srcdir)/src/internal/dynlink.h $(srcdir)/arch/$(ARCH)/reloc.h |
Rich Felker | 179ab5a | 2013-12-01 17:27:25 -0500 | [diff] [blame] | 105 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 106 | obj/crt/crt1.o obj/crt/scrt1.o obj/crt/rcrt1.o obj/src/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h |
Rich Felker | 179ab5a | 2013-12-01 17:27:25 -0500 | [diff] [blame] | 107 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 108 | obj/crt/rcrt1.o: $(srcdir)/src/ldso/dlstart.c |
Rich Felker | d043780 | 2012-08-05 12:32:20 -0400 | [diff] [blame] | 109 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 110 | obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC |
Rich Felker | 585ba14 | 2015-06-03 02:00:44 -0400 | [diff] [blame] | 111 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 112 | obj/crt/$(ARCH)/crti.o: $(srcdir)/crt/$(ARCH)/crti.s |
Rich Felker | c5e34da | 2013-07-26 01:49:14 -0400 | [diff] [blame] | 113 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 114 | obj/crt/$(ARCH)/crtn.o: $(srcdir)/crt/$(ARCH)/crtn.s |
Rich Felker | c5e34da | 2013-07-26 01:49:14 -0400 | [diff] [blame] | 115 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 116 | OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%)) |
| 117 | $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3 |
Rich Felker | a80847d | 2013-07-22 21:22:04 -0400 | [diff] [blame] | 118 | |
Rich Felker | 4a1f55e | 2013-08-01 17:12:23 -0400 | [diff] [blame] | 119 | MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 120 | $(MEMOPS_SRCS:%.c=obj/%.o) $(MEMOPS_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS) |
Rich Felker | 4a1f55e | 2013-08-01 17:12:23 -0400 | [diff] [blame] | 121 | |
Rich Felker | 1ef849c | 2015-04-13 20:13:10 -0400 | [diff] [blame] | 122 | NOSSP_SRCS = $(wildcard crt/*.c) \ |
| 123 | src/env/__libc_start_main.c src/env/__init_tls.c \ |
| 124 | src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \ |
| 125 | src/string/memset.c src/string/memcpy.c \ |
| 126 | src/ldso/dlstart.c src/ldso/dynlink.c |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 127 | $(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP) |
Rich Felker | 1ef849c | 2015-04-13 20:13:10 -0400 | [diff] [blame] | 128 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 129 | $(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT |
Rich Felker | de2b67f | 2015-04-19 22:05:29 -0400 | [diff] [blame] | 130 | |
Rich Felker | 9514e70 | 2016-01-19 19:08:52 -0500 | [diff] [blame] | 131 | $(LOBJS): CFLAGS_ALL += -fPIC -DSHARED |
| 132 | |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 133 | CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $< |
| 134 | |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 135 | # Choose invocation of assembler to be used |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 136 | ifeq ($(ADD_CFI),yes) |
Rich Felker | 9514e70 | 2016-01-19 19:08:52 -0500 | [diff] [blame] | 137 | AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ - |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 138 | else |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 139 | AS_CMD = $(CC_CMD) |
Alex Dowad | 35b3312 | 2015-07-10 15:03:24 +0200 | [diff] [blame] | 140 | endif |
| 141 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 142 | obj/%.o: $(srcdir)/%.s |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 143 | $(AS_CMD) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 144 | |
Rich Felker | 9f5eb77 | 2016-01-19 18:19:01 -0500 | [diff] [blame] | 145 | obj/%.o: $(srcdir)/%.S |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 146 | $(CC_CMD) |
Rich Felker | 9f5eb77 | 2016-01-19 18:19:01 -0500 | [diff] [blame] | 147 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 148 | obj/%.o: $(srcdir)/%.c $(GENH) $(IMPH) |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 149 | $(CC_CMD) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 150 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 151 | obj/%.lo: $(srcdir)/%.s |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 152 | $(AS_CMD) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 153 | |
Rich Felker | 9f5eb77 | 2016-01-19 18:19:01 -0500 | [diff] [blame] | 154 | obj/%.lo: $(srcdir)/%.S |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 155 | $(CC_CMD) |
Rich Felker | 9f5eb77 | 2016-01-19 18:19:01 -0500 | [diff] [blame] | 156 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 157 | obj/%.lo: $(srcdir)/%.c $(GENH) $(IMPH) |
Rich Felker | ada4798 | 2016-01-20 02:58:29 +0000 | [diff] [blame^] | 158 | $(CC_CMD) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 159 | |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 160 | lib/libc.so: $(LOBJS) |
Rich Felker | 9514e70 | 2016-01-19 19:08:52 -0500 | [diff] [blame] | 161 | $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \ |
Rich Felker | 3fa2eb2 | 2014-06-20 00:25:12 -0400 | [diff] [blame] | 162 | -Wl,-e,_dlstart -Wl,-Bsymbolic-functions \ |
Rich Felker | dfdc337 | 2013-03-09 22:34:11 -0500 | [diff] [blame] | 163 | -o $@ $(LOBJS) $(LIBCC) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 164 | |
Rich Felker | 4fd1595 | 2011-02-17 17:12:52 -0500 | [diff] [blame] | 165 | lib/libc.a: $(OBJS) |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 166 | rm -f $@ |
| 167 | $(AR) rc $@ $(OBJS) |
| 168 | $(RANLIB) $@ |
| 169 | |
Rich Felker | 4fd1595 | 2011-02-17 17:12:52 -0500 | [diff] [blame] | 170 | $(EMPTY_LIBS): |
| 171 | rm -f $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 172 | $(AR) rc $@ |
| 173 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 174 | lib/%.o: obj/crt/%.o |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 175 | cp $< $@ |
| 176 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 177 | lib/crti.o: obj/crt/$(ARCH)/crti.o |
| 178 | cp $< $@ |
| 179 | |
| 180 | lib/crtn.o: obj/crt/$(ARCH)/crtn.o |
| 181 | cp $< $@ |
| 182 | |
| 183 | lib/musl-gcc.specs: $(srcdir)/tools/musl-gcc.specs.sh config.mak |
Rich Felker | 58f430c | 2012-04-22 14:32:49 -0400 | [diff] [blame] | 184 | sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@ |
| 185 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 186 | obj/musl-gcc: config.mak |
Shiz | b3cd7d1 | 2015-06-28 23:08:19 +0200 | [diff] [blame] | 187 | printf '#!/bin/sh\nexec "$${REALGCC:-$(WRAPCC_GCC)}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 188 | chmod +x $@ |
| 189 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 190 | obj/%-clang: $(srcdir)/tools/%-clang.in config.mak |
Shiz | fb58545 | 2015-06-28 23:08:21 +0200 | [diff] [blame] | 191 | sed -e 's!@CC@!$(WRAPCC_CLANG)!g' -e 's!@PREFIX@!$(prefix)!g' -e 's!@INCDIR@!$(includedir)!g' -e 's!@LIBDIR@!$(libdir)!g' -e 's!@LDSO@!$(LDSO_PATHNAME)!g' $< > $@ |
| 192 | chmod +x $@ |
| 193 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 194 | $(DESTDIR)$(bindir)/%: obj/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 195 | $(INSTALL) -D $< $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 196 | |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 197 | $(DESTDIR)$(libdir)/%.so: lib/%.so |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 198 | $(INSTALL) -D -m 755 $< $@ |
Rich Felker | 207c45d | 2011-06-27 21:38:11 -0400 | [diff] [blame] | 199 | |
Rich Felker | ec05a0b | 2011-06-23 22:13:47 -0400 | [diff] [blame] | 200 | $(DESTDIR)$(libdir)/%: lib/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 201 | $(INSTALL) -D -m 644 $< $@ |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 202 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 203 | $(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(ARCH)/bits/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 204 | $(INSTALL) -D -m 644 $< $@ |
Rich Felker | d66ab4f | 2013-07-01 13:43:43 -0400 | [diff] [blame] | 205 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 206 | $(DESTDIR)$(includedir)/bits/%: obj/include/bits/% |
| 207 | $(INSTALL) -D -m 644 $< $@ |
| 208 | |
| 209 | $(DESTDIR)$(includedir)/%: $(srcdir)/include/% |
Rich Felker | e678fc6 | 2013-08-17 22:21:11 -0400 | [diff] [blame] | 210 | $(INSTALL) -D -m 644 $< $@ |
Rich Felker | ec05a0b | 2011-06-23 22:13:47 -0400 | [diff] [blame] | 211 | |
Rich Felker | 82fa6b4 | 2013-08-16 17:51:38 -0400 | [diff] [blame] | 212 | $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so |
Rich Felker | 9ff8ed4 | 2013-08-31 11:36:56 -0400 | [diff] [blame] | 213 | $(INSTALL) -D -l $(libdir)/libc.so $@ || true |
Rich Felker | f8e054f | 2012-05-04 21:54:57 -0400 | [diff] [blame] | 214 | |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 215 | install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),) |
| 216 | |
| 217 | install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) |
| 218 | |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 219 | install-tools: $(ALL_TOOLS:obj/%=$(DESTDIR)$(bindir)/%) |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 220 | |
Rich Felker | f807107 | 2014-06-25 16:14:37 -0400 | [diff] [blame] | 221 | musl-git-%.tar.gz: .git |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 222 | git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@) |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 223 | |
Rich Felker | f807107 | 2014-06-25 16:14:37 -0400 | [diff] [blame] | 224 | musl-%.tar.gz: .git |
Petr Hosek | 2f853dd | 2015-11-18 12:07:32 -0800 | [diff] [blame] | 225 | git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@) |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 226 | |
Rich Felker | 0780936 | 2012-08-17 19:32:24 -0400 | [diff] [blame] | 227 | .PHONY: all clean install install-libs install-headers install-tools |