/[projet1]/public/rules.mk
Defence Force logotype

Diff of /public/rules.mk

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1193 by Jylam, Thu Sep 18 21:05:12 2014 UTC revision 1206 by Jylam, Mon Sep 22 18:36:40 2014 UTC
# Line 4  Line 4 
4    
5  # Path of the public/ directory (for instance /home/pennysbird/oric/public/)  # Path of the public/ directory (for instance /home/pennysbird/oric/public/)
6  # OSDKPATH  = /home/user/osdkpath  # OSDKPATH  = /home/user/osdkpath
   
7  CPP       = cpp  CPP       = cpp
8  CFLAGS   += -Wall  CFLAGS   += -Wall
9  TOOLS     =$(OSDKPATH)/pc/tools/osdk/main/  TOOLS     =$(OSDKPATH)/pc/tools/osdk/main/
# Line 18  PICTCONV  =$(TOOLS)/pictconv/pictconv Line 17  PICTCONV  =$(TOOLS)/pictconv/pictconv
17  LINKLIB   =$(TOOLS)/Osdk/_final_/lib/  LINKLIB   =$(TOOLS)/Osdk/_final_/lib/
18  OSDKINC   =$(TOOLS)/Osdk/_final_/include/  OSDKINC   =$(TOOLS)/Osdk/_final_/include/
19  MACROS    =$(TOOLS)/Osdk/_final_/macro/MACROS.H  MACROS    =$(TOOLS)/Osdk/_final_/macro/MACROS.H
20  .PHONY: $(DATA)  .PHONY: $(DATA) compile_c
21    
22  ifndef OSDKPATH  ifndef OSDKPATH
23  $(warning **********************************************)  $(warning **********************************************)
# Line 27  $(warning ****************************** Line 26  $(warning ******************************
26  $(error )  $(error )
27  endif  endif
28    
29  RUNBEFOREHACK:=$(shell rm -f $(BIN).final.s)  RUNBEFOREHACK:=$(shell rm -f $(BIN).final.s $(BIN).final.c)
30    C_FILES=$(filter %.c, $(SRC))
31  %.o: %.s  %.o: %.s
32          cat $< >> $(BIN).final.s          cat $< >> $(BIN).final.s
33  %.o: %.c  %.o: %.c
34          $(CPP) -traditional-cpp -I$(OSDKINC) $< -o .1$<          cat $< >> $(BIN).final.c
         # Remove C comments  
         $(CPP) -xc++ .1$< -o .2$<  
         # Compile  
         $(CC) -O1 .2$< .3$<  
         # Apply macros  
         cpp -traditional-cpp -include $(MACROS) .3$< -o .1$<.s  
         # Removes #'s  
         grep -v '^#' .1$<.s > .2$<.s  
         # Add \n after each assembly instruction  
         $(MSPLIT) .2$<.s .3$<.s  
         cat .3$<.s >> $(BIN).final.s  
35    
36  $(BIN): $(DATA) $(OBJ)  $(BIN): $(DATA) $(OBJ) compile_c
37  ifneq ($(NO_LINK),1)  ifneq ($(NO_LINK),1)
38            $(info LINKIIIIIING)
39          $(LINKER) -d $(LINKLIB) $(BIN).final.s -o .$(BIN).linked.s          $(LINKER) -d $(LINKLIB) $(BIN).final.s -o .$(BIN).linked.s
40  else  else
41                  cp $(BIN).final.s .$(BIN).linked.s                  cp $(BIN).final.s .$(BIN).linked.s
# Line 54  endif Line 43  endif
43          $(AS) .$(BIN).linked.s -o $@.bin -bt 0x500 -C -W -v -l symbols.txt          $(AS) .$(BIN).linked.s -o $@.bin -bt 0x500 -C -W -v -l symbols.txt
44          $(TOOLS)/header/header -a1 $(BIN).bin $(BIN).tap 0x500          $(TOOLS)/header/header -a1 $(BIN).bin $(BIN).tap 0x500
45          chmod +x $(BIN).tap          chmod +x $(BIN).tap
46  clean:  
47    compile_c:
48    ifneq ($(strip $(C_FILES)),)
49            $(CPP) -traditional-cpp -I$(OSDKINC) $(BIN).final.c -o .1$(BIN).c
50            # Remove C comments
51            $(CPP) -xc++ .1$(BIN).c -o .2$(BIN).c
52            # Compile
53            $(CC) -O1 .2$(BIN).c .3$(BIN).c
54            # Apply macros
55            cpp -traditional-cpp -include $(MACROS) .3$(BIN).c -o .0$(BIN).s
56            cp .0$(BIN).s .1$(BIN).s
57            # Removes #'s
58            grep -v '^#' .1$(BIN).s > .2$(BIN).s
59            # Add \n after each assembly instruction
60            $(MSPLIT) .2$(BIN).s .3$(BIN).s
61            cat .3$(BIN).s >> $(BIN).final.s
62    else
63    endif
64    clean::
65          rm -f $(BIN) $(DATA) *.tap *.bin symbols.txt .*.c .*.s          rm -f $(BIN) $(DATA) *.tap *.bin symbols.txt .*.c .*.s
66    

Legend:
Removed from v.1193  
changed lines
  Added in v.1206

  ViewVC Help
Powered by ViewVC 1.1.26