Changeset cec261e in mainline for uspace/lib/Makefile.common


Ignore:
Timestamp:
2010-01-16T21:45:58Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3e30c0b
Parents:
dc9162b (diff), ccb785b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge improvement of remaining userspace makefiles.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/Makefile.common

    rdc9162b rcec261e  
    2828#
    2929
    30 ## Setup toolchain
     30## Common rules for building apps.
    3131#
    3232
    33 include Makefile.common
    34 include $(LIBC_PREFIX)/Makefile.toolchain
    35 include arch/$(UARCH)/Makefile.inc
    36 
    37 CFLAGS += -Iinclude
    38 LINK = arch/$(UARCH)/_link.ld
    39 
    40 ## Sources
     33# Individual makefiles set:
     34#
     35#       USPACE_PREFIX   relative path to uspace/ directory
     36#       LIBS            libraries to link with (with relative path)
     37#       EXTRA_CFLAGS    additional flags to pass to C compiler
     38#       JOB             job file name (like appname.job)
     39#       OUTPUT          output binary name (like appname)
     40#       SOURCES         list of source files
    4141#
    4242
    43 GENERIC_SOURCES = \
    44         main.c \
    45         elf_load.c \
    46         interp.s
     43DEPEND = Makefile.depend
     44DEPEND_PREV = $(DEPEND).prev
    4745
    48 SOURCES := $(GENERIC_SOURCES) $(ARCH_SOURCES)
    49 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
     46LIBC_PREFIX = $(USPACE_PREFIX)/lib/libc
    5047
    51 .PHONY: all
     48JOB = $(OUTPUT).job
    5249
    53 all: $(OUTPUT) $(OUTPUT).disasm
     50OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
     51
     52-include $(USPACE_PREFIX)/../Makefile.config
     53include $(LIBC_PREFIX)/Makefile.toolchain
     54
     55CFLAGS += $(EXTRA_CFLAGS)
     56
     57.PHONY: all build clean
     58
     59all: \
     60    $(LIBC_PREFIX)/../../../version \
     61    $(LIBC_PREFIX)/../../../Makefile.config \
     62    $(LIBC_PREFIX)/../../../config.h \
     63    $(LIBC_PREFIX)/../../../config.defs \
     64    $(LIBS) \
     65    \
     66    $(OUTPUT) \
     67    $(EXTRA_OUTPUT)
     68        -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
     69
     70clean:
     71        rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
     72        find . -name '*.o' -follow -exec rm \{\} \;
     73
     74build:
    5475
    5576-include $(DEPEND)
    5677
    57 $(OUTPUT).disasm: $(OUTPUT)
    58         $(OBJDUMP) -d $< > $@
     78$(OUTPUT): $(OBJECTS)
     79        $(AR) rc $@ $(OBJECTS)
    5980
    60 $(OUTPUT): $(OBJECTS) $(LIBS) $(LINK)
    61         $(LD) -T $(LINK) $(LFLAGS) $(OBJECTS) $(LIBS) -o $@ -Map $(OUTPUT).map
     81%.o: %.S $(DEPEND)
     82        $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@
     83ifeq ($(PRECHECK),y)
     84        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__
     85endif
    6286
    63 $(LINK): $(LINK).in
    64         $(GCC) $(DEFS) $(CFLAGS) -DLIBC_PREFIX=$(LIBC_PREFIX) -E -x c $< | grep -v "^\#" > $@
     87%.o: %.s $(DEPEND)
     88        $(AS) $(AFLAGS) $< -o $@
     89ifeq ($(PRECHECK),y)
     90        $(JOBFILE) $(JOB) $< $@ as asm $(AFLAGS)
     91endif
    6592
    6693%.o: %.c $(DEPEND)
     
    7097endif
    7198
    72 %.o: %.s $(DEPEND)
    73         $(AS) $(AFLAGS) $< -o $@
    74 ifeq ($(PRECHECK),y)
    75         $(JOBFILE) $(JOB) $< $@ as asm $(DEFS) $(CFLAGS)
    76 endif
    77 
    78 $(DEPEND):
     99$(DEPEND): $(PRE_DEPEND)
    79100        makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
    80101        -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
Note: See TracChangeset for help on using the changeset viewer.