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

Annotation of /public/rules.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1207 - (hide annotations)
Mon Sep 22 18:52:24 2014 UTC (5 years, 6 months ago) by Jylam
File size: 2044 byte(s)
Initial OSDKPATH message

1 Jylam 1189 # OSDK rules.mk for GNU Make
2     # Copyright (c) 2014 Jean-Yves Lamoureux <jylam@lnxscene.org>
3    
4    
5     # Path of the public/ directory (for instance /home/pennysbird/oric/public/)
6 Jylam 1207
7    
8     # OSDKPATH = /home/user/oric/public
9    
10    
11 Jylam 1189 CPP = cpp
12     CFLAGS += -Wall
13     TOOLS =$(OSDKPATH)/pc/tools/osdk/main/
14     AS =$(TOOLS)/xa/xa
15     CC =$(TOOLS)/compiler/compiler
16     LINKER =$(TOOLS)/link65/link65
17     MSPLIT =$(TOOLS)/macrosplitter/macrosplitter
18     BIN2TXT =$(TOOLS)/bin2txt/bin2txt
19     FILEPACK =$(TOOLS)/filepack/filepack
20     PICTCONV =$(TOOLS)/pictconv/pictconv
21     LINKLIB =$(TOOLS)/Osdk/_final_/lib/
22     OSDKINC =$(TOOLS)/Osdk/_final_/include/
23     MACROS =$(TOOLS)/Osdk/_final_/macro/MACROS.H
24 Jylam 1206 .PHONY: $(DATA) compile_c
25 Jylam 1189
26     ifndef OSDKPATH
27 Jylam 1207 $(warning ***)
28 Jylam 1189 $(warning **********************************************)
29 Jylam 1207 $(warning You must edit)
30     $(warning $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/rules.mk)
31     $(warning an fill OSDKPATH)
32 Jylam 1189 $(warning **********************************************)
33     $(error )
34     endif
35    
36 Jylam 1206 RUNBEFOREHACK:=$(shell rm -f $(BIN).final.s $(BIN).final.c)
37     C_FILES=$(filter %.c, $(SRC))
38 Jylam 1189 %.o: %.s
39     cat $< >> $(BIN).final.s
40     %.o: %.c
41 Jylam 1206 cat $< >> $(BIN).final.c
42 Jylam 1189
43 Jylam 1206 $(BIN): $(DATA) $(OBJ) compile_c
44 Jylam 1189 ifneq ($(NO_LINK),1)
45 Jylam 1206 $(info LINKIIIIIING)
46 Jylam 1189 $(LINKER) -d $(LINKLIB) $(BIN).final.s -o .$(BIN).linked.s
47     else
48     cp $(BIN).final.s .$(BIN).linked.s
49     endif
50     $(AS) .$(BIN).linked.s -o $@.bin -bt 0x500 -C -W -v -l symbols.txt
51     $(TOOLS)/header/header -a1 $(BIN).bin $(BIN).tap 0x500
52     chmod +x $(BIN).tap
53 Jylam 1206
54     compile_c:
55     ifneq ($(strip $(C_FILES)),)
56     $(CPP) -traditional-cpp -I$(OSDKINC) $(BIN).final.c -o .1$(BIN).c
57     # Remove C comments
58     $(CPP) -xc++ .1$(BIN).c -o .2$(BIN).c
59     # Compile
60     $(CC) -O1 .2$(BIN).c .3$(BIN).c
61     # Apply macros
62     cpp -traditional-cpp -include $(MACROS) .3$(BIN).c -o .0$(BIN).s
63     cp .0$(BIN).s .1$(BIN).s
64     # Removes #'s
65     grep -v '^#' .1$(BIN).s > .2$(BIN).s
66     # Add \n after each assembly instruction
67     $(MSPLIT) .2$(BIN).s .3$(BIN).s
68     cat .3$(BIN).s >> $(BIN).final.s
69     else
70     endif
71     clean::
72 Jylam 1189 rm -f $(BIN) $(DATA) *.tap *.bin symbols.txt .*.c .*.s
73    

  ViewVC Help
Powered by ViewVC 1.1.26