Makefile 1.7 KB

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