Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. MAKEFLAGS += --check-symlink-times
  2. CC = gcc
  3. AS = gcc
  4. AR = ar rcs
  5. CFLAGS = -Wall -fPIC -O2 -std=gnu99 -fgnu89-inline -Wall -U_FORTIFY_SOURCE \
  6. -fno-omit-frame-pointer \
  7. -fno-stack-protector -fno-builtin \
  8. -I. -I../.. -I../../../include -I../../../lib -I../../../ipc/linux \
  9. -I../../../linux-3.5/graphene
  10. ASFLAGS = -DPIC -DSHARED -fPIC -DASSEMBLER -Wa,--noexecstack \
  11. -x assembler-with-cpp \
  12. -I. -I../.. -I../../../include
  13. ARFLAGS =
  14. host_target = libpal-Linux.a
  15. defs = -DIN_PAL -DSRCDIR="$(PWD)/" -DPAL_LOADER_PATH="$(shell readlink -f ../../pal)" \
  16. -DGDB_SCRIPT="$(CURDIR)/pal-gdb.py"
  17. objs = $(addprefix db_,files devices pipes sockets streams memory threading \
  18. semaphore mutex events process object main rtld misc ipc \
  19. exception) manifest clone-x86_64 gettimeofday-x86_64
  20. graphene_lib = ../../../lib/graphene-lib.a
  21. headers = $(wildcard *.h) $(wildcard ../../*.h) $(wildcard ../../../lib/*.h)
  22. all: $(host_target)
  23. debug: debug = debug
  24. debug: CC = gcc -g
  25. debug: CFLAGS += -DDEBUG
  26. debug: $(host_target)
  27. $(graphene_lib):
  28. make -C ../../../lib $(debug)
  29. libpal-Linux.a: $(addsuffix .o,$(objs)) $(graphene_lib)
  30. @echo [ host/Linux/$@ ]
  31. @$(AR) $(ARFLAGS) $@ $^
  32. %.asm: %.c $(headers)
  33. $(CC) $(CFLAGS) $(defs) -c $< -o $<.o
  34. @objdump -S $<.o > $@
  35. @rm $<.o
  36. %.o: %.c $(headers)
  37. @echo [ host/Linux/$@ ]
  38. @$(CC) $(CFLAGS) $(defs) -c $< -o $@
  39. %.e: %.c $(headers)
  40. @echo [ host/Linux/$@ ]
  41. @$(CC) $(CFLAGS) $(defs) -E $< -o $@
  42. %.o: %.S $(headers)
  43. @echo [ host/Linux/$@ ]
  44. @$(AS) $(ASFLAGS) $(defs) -c $< -o $@
  45. %.e: %.S $(headers)
  46. @echo [ host/Linux/$@ ]
  47. @$(AS) $(ASFLAGS) $(defs) -E $< -o $@
  48. clean:
  49. rm -f $(addsuffix .o,$(objs)) $(host_target)