Skip to content

Commit

Permalink
[Makefile] add targets for .i and .s
Browse files Browse the repository at this point in the history
For prepossessed file, .i for .c and .s for .S are commonly used.
not .e.
This patch adds rules to produce .i/.s file in addition to .e.

Signed-off-by: Isaku Yamahata <[email protected]>
  • Loading branch information
yamahata authored and donporter committed Mar 25, 2019
1 parent 4b190ba commit 38ac398
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
/Jenkinsfiles/JenkinsfileSGX-*

.lib
*.i
*.s
*.e
8 changes: 6 additions & 2 deletions LibOS/shim/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,19 @@ elf/shim_rtld.o: $(wildcard elf/*.h)
@echo [ $@ ]
@$(CC) $(CFLAGS) $(defs) -c $< -o $@

%.e: %.c $(headers)
%.e %.i: %.c $(headers)
@echo [ $@ ]
@$(CC) $(CFLAGS) $(defs) -E $< -o $@

%.s: %.c $(headers)
@echo [ $@ ]
@$(CC) $(CFLAGS) $(defs) -S $< -o $@

%.o: %.S $(headers)
@echo [ $@ ]
@$(AS) $(ASFLAGS) $(defs) -c $< -o $@

%.e: %.S $(headers)
%.e %.s: %.S $(headers)
@echo [ $@ ]
@$(AS) $(ASFLAGS) $(defs) -E $< -o $@

Expand Down
7 changes: 6 additions & 1 deletion Pal/src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,16 @@ $(OBJ_DIR)/%.o: %.c $(headers)
@echo [ $@ ]
@$(CC) $(CFLAGS) $(defs) -c $< -o $@ $(CFLAGS-suffix)

$(OBJ_DIR)/%.e: %.c $(headers)
$(OBJ_DIR)/%.e $(OBJ_DIR)/%.i: %.c $(headers)
@mkdir -p $(OBJ_DIR)
@echo [ $@ ]
@$(CC) $(CFLAGS) $(defs) -E $< -o $@ $(CFLAGS-suffix)

$(OBJ_DIR)/%.s: %.c $(headers)
@mkdir -p $(OBJ_DIR)
@echo [ $@ ]
@$(CC) $(CFLAGS) $(defs) -S $< -o $@ $(CFLAGS-suffix)

.PHONY: clean
clean:
rm -rf $(LIB_DIR) $(OBJ_DIR) $(files_to_build)
Expand Down
8 changes: 6 additions & 2 deletions Pal/src/host/FreeBSD/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ libpal-FreeBSD.a: $(addsuffix .o,$(objs)) $(graphene_lib)
@echo [ host/FreeBSD/$@ ]
@$(CC) $(CFLAGS) $(defs) -c $< -o $@

%.e: %.c $(headers)
%.e %.i: %.c $(headers)
@echo [ host/FreeBSD/$@ ]
@$(CC) $(CFLAGS) $(defs) -E $< -o $@

%.s: %.c $(headers)
@echo [ host/FreeBSD/$@ ]
@$(CC) $(CFLAGS) $(defs) -S $< -o $@

%.o: %.S $(headers)
@echo [ host/FreeBSD/$@ ]
@$(AS) $(ASFLAGS) $(defs) -c $< -o $@

%.e: %.S $(headers)
%.e %.s: %.S $(headers)
@echo [ host/FreeBSD/$@ ]
@$(AS) $(ASFLAGS) $(defs) -E $< -o $@

Expand Down
26 changes: 25 additions & 1 deletion Pal/src/host/Linux-SGX/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,22 @@ $(addsuffix .e,$(enclave-objs)): %.e: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(CFLAGS) $(defs) -DIN_ENCLAVE -E $< -o $@

$(addsuffix .i,$(enclave-objs)): %.i: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(CFLAGS) $(defs) -DIN_ENCLAVE -E $< -o $@

$(addsuffix .s,$(enclave-objs)): %.s: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(CFLAGS) $(defs) -DIN_ENCLAVE -S $< -o $@

$(addsuffix .o,$(enclave-asm-objs)): %.o: %.S $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(AS) $(ASFLAGS) $(defs) -DIN_ENCLAVE -c $< -o $@

$(addsuffix .s,$(enclave-asm-objs)): %.s: %.S $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(AS) $(ASFLAGS) $(defs) -DIN_ENCLAVE -E $< -o $@

$(addsuffix .o,$(urts-objs)): %.o: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(filter-out -DIN_ENCLAVE,$(CFLAGS)) $(defs) -c $< -o $@
Expand All @@ -53,6 +65,18 @@ $(addsuffix .e,$(urts-objs)): %.e: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(filter-out -DIN_ENCLAVE,$(CFLAGS)) $(defs) -E $< -o $@

$(addsuffix .i,$(urts-objs)): %.i: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(filter-out -DIN_ENCLAVE,$(CFLAGS)) $(defs) -E $< -o $@

$(addsuffix .s,$(urts-objs)): %.s: %.c $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(CC) $(filter-out -DIN_ENCLAVE,$(CFLAGS)) $(defs) -S $< -o $@

$(addsuffix .s,$(urts-asm-objs)): %.s: %.S $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(AS) $(filter-out -DIN_ENCLAVE,$(ASFLAGS)) $(defs) -E $< -o $@

$(addsuffix .o,$(urts-asm-objs)): %.o: %.S $(headers)
@echo [ host/Linux-SGX/$@ ]
@$(AS) $(filter-out -DIN_ENCLAVE,$(ASFLAGS)) $(defs) -c $< -o $@
Expand All @@ -74,4 +98,4 @@ CLEAN_FILES += debugger/sgx_gdb.o

.PHONY: clean
clean:
rm -f *.o *.e $(host_files) $(CLEAN_FILES)
rm -f *.o *.e *.i *.s $(host_files) $(CLEAN_FILES)
8 changes: 6 additions & 2 deletions Pal/src/host/Linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,19 @@ libpal-Linux.a: $(addsuffix .o,$(objs)) $(graphene_lib)
@echo [ host/Linux/$@ ]
@$(CC) $(CFLAGS) $(defs) -c $< -o $@

%.e: %.c $(headers)
%.e %.i: %.c $(headers)
@echo [ host/Linux/$@ ]
@$(CC) $(CFLAGS) $(defs) -E $< -o $@

%.s: %.c $(headers)
@echo [ host/Linux/$@ ]
@$(CC) $(CFLAGS) $(defs) -S $< -o $@

%.o: %.S $(headers)
@echo [ host/Linux/$@ ]
@$(AS) $(ASFLAGS) $(defs) -c $< -o $@

%.e: %.S $(headers)
%.e %.s: %.S $(headers)
@echo [ host/Linux/$@ ]
@$(AS) $(ASFLAGS) $(defs) -E $< -o $@

Expand Down
6 changes: 5 additions & 1 deletion Pal/src/security/Linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ libpal_sec.so: $(addsuffix .o,$(objs)) $(graphene_lib)
@echo [ security/Linux/$@ ]
@$(CC) $(CFLAGS) -c $< -o $@

%.e: %.c
%.e %.i: %.c
@echo [ security/Linux/$@ ]
@$(CC) $(CFLAGS) -E $< -o $@

%.s: %.c
@echo [ security/Linux/$@ ]
@$(CC) $(CFLAGS) -S $< -o $@

.PHONY: clean
clean:
rm -rf *.o libpal_sec.so

0 comments on commit 38ac398

Please sign in to comment.